saving the plot

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

saving the plot

Raag Saluja
Hi! 
When I view my subplots, I need to extend the screen in order to view the whole thing or the x axis labels get overlapped and you can't read anything. However, when I save my plot as an image, the screen size returns to the original size and all the labels are overlapped. How can I save the image such that the screen size doesn't return to the original dimensions? These are the commands I used:

hold on

h=figure(1)

saveas (h, 'myplot.png')


Thank you and regards,

Raag Saluja,

Research scholar

Department of Zoology,

Faculty of Science

Dayalbagh Educational Institute

India



Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

BGreen

On Thu, Nov 14, 2019 at 12:50 AM Raag Saluja <[hidden email]> wrote:
Hi! 
When I view my subplots, I need to extend the screen in order to view the whole thing or the x axis labels get overlapped and you can't read anything. However, when I save my plot as an image, the screen size returns to the original size and all the labels are overlapped. How can I save the image such that the screen size doesn't return to the original dimensions? These are the commands I used:

hold on

h=figure(1)

saveas (h, 'myplot.png')


Thank you and regards,

Raag Saluja,

Research scholar

Department of Zoology,

Faculty of Science

Dayalbagh Educational Institute

India



I've noticed inconsistency between GUI-displayed and saved text sizes as well, but unfortunately I do not know the solution. That said, the rest of us can't really help unless you send us an example to work with. Please send the code you used to generate the plot.

My guess is that calling the figure command with the position property will solve the problem. From the documentation:
position: four-element vector, def. [300 200 560 420]

Specify the position and size of the figure canvas. The four elements of the vector are the coordinates of the lower left corner and width and height of the figure. See units property.

For example, I begin figures I want to save with:

figure(1,"position",[350,100,1597,987])

The last two are the width and height, respectively. Try doing this first instead of manually resizing.



Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

Raag Saluja
It did resize the screen, thanks! However, when I saved the file, the screen size became smaller again! This is the code I used:

X = 1:6; 

 

P = [-2920000 -2936000 -2935000 -2937000 -2939000 -2938000];

C = [16400 16450 16200 12800 16800 16000];

E= [-2441000 -2438000 -2452000 -2454000 -2453000 -2454200];

L = [514900 515500 15900 513200 516700 516900];

D= [2340000 3100000 3140000 3530000 3170000 3350000];

subplot(2,3,1)

bar(P, 'k',0.8)

set(gca, "linewidth", 4, "fontsize", 12)

set(gca,"xticklabel",{'1JFF','α1aβII', 'α1aβIII', 'α1bβII', 'α1bβIII', 'α8β8'},"XTick",1:numel(P));

ylabel('kJ/mol')

title ("Average potential energies");

ylim ([-2940000 -2910000])

 

subplot(2,3,2)

bar(E, 'k',0.8)

set(gca, "linewidth", 4, "fontsize", 12)

set(gca,"xticklabel",{'1JFF','α1aβII', 'α1aβIII', 'α1bβII', 'α1bβIII', 'α8β8'},"XTick",1:numel(P));

title ("Average enthalpy");

ylabel('kJ/mol')

 

subplot(2,3,3)

bar(C, 'k',0.8)

set(gca, "linewidth", 4, "fontsize", 12)

set(gca,"xticklabel",{'1JFF','α1aβII', 'α1aβIII', 'α1bβII', 'α1bβIII', 'α8β8'},"XTick",1:numel(P));

title ("Average coulomb (reciprocal) interactions");

ylim ([12500 18000])

ylabel('kJ/mol')

 

subplot(2,3,4)

bar(L,'k',0.8)

set(gca, "linewidth", 4, "fontsize", 12)

set(gca,"xticklabel",{'1JFF','α1aβII', 'α1aβIII', 'α1bβII', 'α1bβIII', 'α8β8'},"XTick",1:numel(P));

title ("Average Lennard-Jones interactions");

ylim ([1000 550000])

ylabel('kJ/mol')

 

subplot(2,3,5)

bar(D, 'k',0.8)

set(gca, "linewidth", 4, "fontsize", 12)

set(gca,"xticklabel",{'1JFF','α1aβII', 'α1aβIII', 'α1bβII', 'α1bβIII', 'α8β8'},"XTick",1:numel(P));

ylabel('Debye')

title ("Average dipole moments");

ylim ([2300000 3600000])

 

hold on

h=figure(1)

saveas (h, 'myplot.png')


PFA the screenshot of the octave screen and the saved file.

Thanks and regards,
Raag

On Thu, Nov 14, 2019 at 10:16 PM Brett Green <[hidden email]> wrote:

On Thu, Nov 14, 2019 at 12:50 AM Raag Saluja <[hidden email]> wrote:
Hi! 
When I view my subplots, I need to extend the screen in order to view the whole thing or the x axis labels get overlapped and you can't read anything. However, when I save my plot as an image, the screen size returns to the original size and all the labels are overlapped. How can I save the image such that the screen size doesn't return to the original dimensions? These are the commands I used:

hold on

h=figure(1)

saveas (h, 'myplot.png')


Thank you and regards,

Raag Saluja,

Research scholar

Department of Zoology,

Faculty of Science

Dayalbagh Educational Institute

India



I've noticed inconsistency between GUI-displayed and saved text sizes as well, but unfortunately I do not know the solution. That said, the rest of us can't really help unless you send us an example to work with. Please send the code you used to generate the plot.

My guess is that calling the figure command with the position property will solve the problem. From the documentation:
position: four-element vector, def. [300 200 560 420]

Specify the position and size of the figure canvas. The four elements of the vector are the coordinates of the lower left corner and width and height of the figure. See units property.

For example, I begin figures I want to save with:

figure(1,"position",[350,100,1597,987])

The last two are the width and height, respectively. Try doing this first instead of manually resizing.




actual screen of octave.png (353K) Download Attachment
myplot.png (117K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

mmuetzel
Am 15. November 2019 um 07:33 Uhr schrieb "Raag Saluja":
> It did resize the screen, thanks! However, when I saved the file, the screen size became smaller again!

Try setting the "paperpositionmode" of the figure to "auto":

hf = figure(1);
set(hf, 'paperpositionmode', 'auto');
saveas (hf, 'myplot.png');

HTH,
Markus


Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

Raag Saluja
Thanks! This is definitely better!. However, the x-axis labels are still a bit overlapped in the fig saved.

On Fri, Nov 15, 2019 at 8:49 PM "Markus Mützel" <[hidden email]> wrote:
Am 15. November 2019 um 07:33 Uhr schrieb "Raag Saluja":
> It did resize the screen, thanks! However, when I saved the file, the screen size became smaller again!

Try setting the "paperpositionmode" of the figure to "auto":

hf = figure(1);
set(hf, 'paperpositionmode', 'auto');
saveas (hf, 'myplot.png');

HTH,
Markus


Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

Raag Saluja
hi! can something please be done to correct this error? thanks

On Fri, Nov 29, 2019 at 1:04 PM Raag Saluja <[hidden email]> wrote:
Thanks! This is definitely better!. However, the x-axis labels are still a bit overlapped in the fig saved.

On Fri, Nov 15, 2019 at 8:49 PM "Markus Mützel" <[hidden email]> wrote:
Am 15. November 2019 um 07:33 Uhr schrieb "Raag Saluja":
> It did resize the screen, thanks! However, when I saved the file, the screen size became smaller again!

Try setting the "paperpositionmode" of the figure to "auto":

hf = figure(1);
set(hf, 'paperpositionmode', 'auto');
saveas (hf, 'myplot.png');

HTH,
Markus


Reply | Threaded
Open this post in threaded view
|

Re: saving the plot

Ardid, Salva-2

El dijous, 5 de desembre de 2019, a les 4:31:10 EST, Raag Saluja va escriure:

  hi! can something please be done to correct this error? thanks
 
  On Fri, Nov 29, 2019 at 1:04 PM Raag Saluja <[hidden email]> wrote:
 
  > Thanks! This is definitely better!. However, the x-axis labels are still a
  > bit overlapped in the fig saved.
  >
  > On Fri, Nov 15, 2019 at 8:49 PM "Markus Mützel" <[hidden email]>
  > wrote:
  >
  >> Am 15. November 2019 um 07:33 Uhr schrieb "Raag Saluja":
  >> > It did resize the screen, thanks! However, when I saved the file, the
  >> screen size became smaller again!
  >>
  >> Try setting the "paperpositionmode" of the figure to "auto":
  >>
  >> hf = figure(1);
  >> set(hf, 'paperpositionmode', 'auto');
  >> saveas (hf, 'myplot.png');
  >>
  >> HTH,
  >> Markus
  >>
  >
 
Hi,

I ignore what you are plotting and why octave is not saving it as you would like but in any case, you could also give fig2svg toolbox a try: https://github.com/kupiqu/fig2svg

If fig2svg doesn't work as you would expect, you can create an issue for it giving the example code that generates the dissonance.

Best