How to remove the bland space to the left of ylabel in Matlab figure when using long string for ylabel?
I'm doing some plots in Matlab 2014b, in one them I'm plotting 5 variables versus time over there and want to specify 5 names like, speed (rad/sec), voltage (V), ... etc. on the y-label, however, as you can see in the picture, I'm getting extra bland space on the left, and struggling to removed it.
Here is a working code, just to explain the situation:
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Any suggestions are highly appreciated in advance.
graphics latex matlab matplotlib
|
show 1 more comment
I'm doing some plots in Matlab 2014b, in one them I'm plotting 5 variables versus time over there and want to specify 5 names like, speed (rad/sec), voltage (V), ... etc. on the y-label, however, as you can see in the picture, I'm getting extra bland space on the left, and struggling to removed it.
Here is a working code, just to explain the situation:
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Any suggestions are highly appreciated in advance.
graphics latex matlab matplotlib
1
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Better yet: after you've created your plot, run the commandgcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.
– Saaru Lindestøkke
Dec 5 at 10:35
Runninggcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window
– AlFagera
Dec 5 at 12:41
|
show 1 more comment
I'm doing some plots in Matlab 2014b, in one them I'm plotting 5 variables versus time over there and want to specify 5 names like, speed (rad/sec), voltage (V), ... etc. on the y-label, however, as you can see in the picture, I'm getting extra bland space on the left, and struggling to removed it.
Here is a working code, just to explain the situation:
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Any suggestions are highly appreciated in advance.
graphics latex matlab matplotlib
I'm doing some plots in Matlab 2014b, in one them I'm plotting 5 variables versus time over there and want to specify 5 names like, speed (rad/sec), voltage (V), ... etc. on the y-label, however, as you can see in the picture, I'm getting extra bland space on the left, and struggling to removed it.
Here is a working code, just to explain the situation:
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Any suggestions are highly appreciated in advance.
graphics latex matlab matplotlib
graphics latex matlab matplotlib
edited Dec 5 at 14:18
asked Dec 5 at 9:35
AlFagera
1386
1386
1
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Better yet: after you've created your plot, run the commandgcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.
– Saaru Lindestøkke
Dec 5 at 10:35
Runninggcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window
– AlFagera
Dec 5 at 12:41
|
show 1 more comment
1
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Better yet: after you've created your plot, run the commandgcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.
– Saaru Lindestøkke
Dec 5 at 10:35
Runninggcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window
– AlFagera
Dec 5 at 12:41
1
1
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Better yet: after you've created your plot, run the command
gcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.– Saaru Lindestøkke
Dec 5 at 10:35
Better yet: after you've created your plot, run the command
gcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.– Saaru Lindestøkke
Dec 5 at 10:35
Running
gcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window– AlFagera
Dec 5 at 12:41
Running
gcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window– AlFagera
Dec 5 at 12:41
|
show 1 more comment
1 Answer
1
active
oldest
votes
You can tweak the positioning of the axes in the figure window as follows (using your example code):
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure;
ax = handle(gca);
ax.Position = [0.1, 0.15, 0.8, 0.75];
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Explanation of the code
In ax = handle(gca);
you store the axes handle in variable ax
such that you can alter it later on.
In ax.Position [0.1, 0.15, 0.8, 0.75];
you change the position of the axes in the figure referred by handle ax
. The example above sets the lower left point at the coordinates 0.1, 0.15
and a width and height of 0.8
and 0.75
respectively. These coordinates are normalized w.r.t. to your figure size.
Example plots
Initial situation
If you set the ax.Position
to [0.25, 0.15, 0.7, 0.75]
you get something like you had initially:
Solution
If you set the ax.Position
to [0.1, 0.1, 0.85, 0.85]
you get far less whitespace:
Notes
This MATLAB help link explains how you can define the axes position "automatically" such that there is a tighter fit.
This MATLAB help link on axes explains what parameters are available in the axes object.
This answer over at Stackoverflow helped me find a way to use the dot notation in MATLAB versions prior to 2014b. Apparently using handle()
is also faster than the set
and get
methods.
Belief it or not, using this commandh.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set:h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this commandax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure
– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as acceptedh = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do preferax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380952%2fhow-to-remove-the-bland-space-to-the-left-of-ylabel-in-matlab-figure-when-using%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can tweak the positioning of the axes in the figure window as follows (using your example code):
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure;
ax = handle(gca);
ax.Position = [0.1, 0.15, 0.8, 0.75];
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Explanation of the code
In ax = handle(gca);
you store the axes handle in variable ax
such that you can alter it later on.
In ax.Position [0.1, 0.15, 0.8, 0.75];
you change the position of the axes in the figure referred by handle ax
. The example above sets the lower left point at the coordinates 0.1, 0.15
and a width and height of 0.8
and 0.75
respectively. These coordinates are normalized w.r.t. to your figure size.
Example plots
Initial situation
If you set the ax.Position
to [0.25, 0.15, 0.7, 0.75]
you get something like you had initially:
Solution
If you set the ax.Position
to [0.1, 0.1, 0.85, 0.85]
you get far less whitespace:
Notes
This MATLAB help link explains how you can define the axes position "automatically" such that there is a tighter fit.
This MATLAB help link on axes explains what parameters are available in the axes object.
This answer over at Stackoverflow helped me find a way to use the dot notation in MATLAB versions prior to 2014b. Apparently using handle()
is also faster than the set
and get
methods.
Belief it or not, using this commandh.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set:h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this commandax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure
– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as acceptedh = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do preferax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
add a comment |
You can tweak the positioning of the axes in the figure window as follows (using your example code):
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure;
ax = handle(gca);
ax.Position = [0.1, 0.15, 0.8, 0.75];
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Explanation of the code
In ax = handle(gca);
you store the axes handle in variable ax
such that you can alter it later on.
In ax.Position [0.1, 0.15, 0.8, 0.75];
you change the position of the axes in the figure referred by handle ax
. The example above sets the lower left point at the coordinates 0.1, 0.15
and a width and height of 0.8
and 0.75
respectively. These coordinates are normalized w.r.t. to your figure size.
Example plots
Initial situation
If you set the ax.Position
to [0.25, 0.15, 0.7, 0.75]
you get something like you had initially:
Solution
If you set the ax.Position
to [0.1, 0.1, 0.85, 0.85]
you get far less whitespace:
Notes
This MATLAB help link explains how you can define the axes position "automatically" such that there is a tighter fit.
This MATLAB help link on axes explains what parameters are available in the axes object.
This answer over at Stackoverflow helped me find a way to use the dot notation in MATLAB versions prior to 2014b. Apparently using handle()
is also faster than the set
and get
methods.
Belief it or not, using this commandh.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set:h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this commandax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure
– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as acceptedh = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do preferax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
add a comment |
You can tweak the positioning of the axes in the figure window as follows (using your example code):
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure;
ax = handle(gca);
ax.Position = [0.1, 0.15, 0.8, 0.75];
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Explanation of the code
In ax = handle(gca);
you store the axes handle in variable ax
such that you can alter it later on.
In ax.Position [0.1, 0.15, 0.8, 0.75];
you change the position of the axes in the figure referred by handle ax
. The example above sets the lower left point at the coordinates 0.1, 0.15
and a width and height of 0.8
and 0.75
respectively. These coordinates are normalized w.r.t. to your figure size.
Example plots
Initial situation
If you set the ax.Position
to [0.25, 0.15, 0.7, 0.75]
you get something like you had initially:
Solution
If you set the ax.Position
to [0.1, 0.1, 0.85, 0.85]
you get far less whitespace:
Notes
This MATLAB help link explains how you can define the axes position "automatically" such that there is a tighter fit.
This MATLAB help link on axes explains what parameters are available in the axes object.
This answer over at Stackoverflow helped me find a way to use the dot notation in MATLAB versions prior to 2014b. Apparently using handle()
is also faster than the set
and get
methods.
You can tweak the positioning of the axes in the figure window as follows (using your example code):
clear all; clc; close all;
x = rand(8,1);
y = rand(8,1);
figure;
ax = handle(gca);
ax.Position = [0.1, 0.15, 0.8, 0.75];
plot(x,y)
xlabel('time (s)')
ylabel('$x$ (m), $theta$ (rad), $dot{x}$ (m/s),$dot{theta}$ (rad/s), $dot{S}_{gen}$(W/K)','Interpreter', 'latex','fontsize',10)
grid
Explanation of the code
In ax = handle(gca);
you store the axes handle in variable ax
such that you can alter it later on.
In ax.Position [0.1, 0.15, 0.8, 0.75];
you change the position of the axes in the figure referred by handle ax
. The example above sets the lower left point at the coordinates 0.1, 0.15
and a width and height of 0.8
and 0.75
respectively. These coordinates are normalized w.r.t. to your figure size.
Example plots
Initial situation
If you set the ax.Position
to [0.25, 0.15, 0.7, 0.75]
you get something like you had initially:
Solution
If you set the ax.Position
to [0.1, 0.1, 0.85, 0.85]
you get far less whitespace:
Notes
This MATLAB help link explains how you can define the axes position "automatically" such that there is a tighter fit.
This MATLAB help link on axes explains what parameters are available in the axes object.
This answer over at Stackoverflow helped me find a way to use the dot notation in MATLAB versions prior to 2014b. Apparently using handle()
is also faster than the set
and get
methods.
edited Dec 5 at 20:12
answered Dec 5 at 13:16
Saaru Lindestøkke
65521032
65521032
Belief it or not, using this commandh.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set:h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this commandax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure
– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as acceptedh = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do preferax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
add a comment |
Belief it or not, using this commandh.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set:h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this commandax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure
– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as acceptedh = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do preferax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
Belief it or not, using this command
h.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set: h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this command ax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure– AlFagera
Dec 5 at 14:57
Belief it or not, using this command
h.CurrentAxes.Position = [0.1, 0.1, 0.75, 0.75];
I got no change in my plot, even when I set: h.CurrentAxes.Position = [0.01, 0.01, 0.5, 0.5];
Only I got this warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details.". however, the links you provided have helped me to solve the problem, especially the 2nd link It turned out I only need to add this command ax1 = axes('Position',[0.15 0.15 0.75 0.75]);
after figure– AlFagera
Dec 5 at 14:57
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Nice to hear that your problem is solved. I think the error you receive is due to a mismatch of our Matlab versions. Apparently you cannot use the dot notation in your version of Matlab to assign the figure properties. Are you sure you use version 2014b? This question is about the error you see.
– Saaru Lindestøkke
Dec 5 at 15:54
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as accepted
h = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
Yes, I'm sure of my 2014b version, actually its stated there that: "Starting in R2014b, you can use dot notation to query and set properties. If you are using an earlier release, use the get and set functions instead." as the question you share: Accessing graphic object properties using dot notation on Matlab versions anterior to (before) R2014b. I would suggest that you modify your answer such that I can mark it as accepted
h = figure; ax1 = axes('Position',[0.15 0.15 0.75 0.75]); plot()
– AlFagera
Dec 5 at 16:12
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
I've modified it.
– Saaru Lindestøkke
Dec 5 at 20:14
Ok, though I do prefer
ax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
Ok, though I do prefer
ax.Position = [0.15, 0.15, 0.75, 0.75];
– AlFagera
Dec 6 at 7:02
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380952%2fhow-to-remove-the-bland-space-to-the-left-of-ylabel-in-matlab-figure-when-using%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Which version of Matlab? I don't have that problem on 2018b with the code you've provided: imgur.com/CktT8ME The plot has the following (default for me) settings: pastebin.com/00GFw7X3
– Saaru Lindestøkke
Dec 5 at 10:07
I'm using Matlab 2014b
– AlFagera
Dec 5 at 10:10
Ok, I don't have access to that version. Perhaps you can take a look at my plot settings and compare them to yours to see if there's a difference there?
– Saaru Lindestøkke
Dec 5 at 10:13
Better yet: after you've created your plot, run the command
gcf
and post it's output (make sure to show all properties) in your questions so we can take a look at it.– Saaru Lindestøkke
Dec 5 at 10:35
Running
gcf
almost produce nothing, only a blank figure wizard is shown and ans = 1 is displayed in the command window– AlFagera
Dec 5 at 12:41