plot3 - How to "automate" desired plot settings?

조회 수: 2 (최근 30일)
rbarata
rbarata 2015년 11월 21일
댓글: KAE 2017년 2월 9일
Warning: New to matlab so it's a basic question
Given 3 vectors x, y and z how can I set box appearence without having to write:
>> plot3(x,y,z)
>> ax=gca;
>> box on
>> ax.BoxStyle='full';
Thanks
  댓글 수: 4
Matthew Crema
Matthew Crema 2015년 11월 21일
One way is to add the following to startup.m
set(0, 'DefaultAxesBox', 'on')
There may be some similar code to set the default 'BoxStyle' property, but I am unable to test (also running an older version of MATLAB).
rbarata
rbarata 2015년 11월 21일
편집: rbarata 2015년 11월 21일
I've found this in the help: Default Properties Values but I'm having some difficulties in its application.
Could you post an example?

댓글을 달려면 로그인하십시오.

답변 (1개)

Geoff Hayes
Geoff Hayes 2015년 11월 22일
rbarata - to be clear, I don't know if the below will work or if this is the intended manner in which the groot object is to be used. It didn't work for me but that could be because I am using R2014a. So this answer may be completely incorrect.
Anyway, using the link you provided, I can query the factory property values for the axes object as
get(groot,'factoryAxes')
which will return a list of all axes properties (prefixed with factoryAxes) and their assigned (default) value. You can then replace those "factory" settings with default setting of your own choice by doing something like
set(groot,'DefaultAxesBox','on','DefaultAxesBoxStyle','full')
Note how the factory prefix from the properties listed in the first function call has been removed when I want to set the property. For example, factoryAxesBox becomes DefaultAxesBox.
Now, to see the list of default values assigned for the current MATLAB session, type
get(groot,'Default')
and you should see something similar to
ans =
defaultFigurePosition: [680 678 560 420]
defaultFigurePaperPositionMode: 'manual'
defaultAxesBox: 'on'
defaultAxesBoxStyle: 'full'
So now if you were to create an axes object, the Box property should be on, and the BoxStyle should be full. And I'm saying should because that is my understanding of how it should work but it didn't for me. :(
Perhaps someone else can clarify the intent of the default vs factory settings.
  댓글 수: 1
KAE
KAE 2017년 2월 9일
Jan Simon's answer here makes it sound like it is not possible to permanently turn off the axes box: the moment you make a plot the box will reappear.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by