Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In my function it returns a plot of my data, say example, using ListLinePlot, and this is the size I obtain:

enter image description here

enter image description here

but when running a series of simulations inside a Table:

Table[tCorrStudentsT[i]=sensStudentsT[sensMat[[i]], mcRun,chrT,hrT,ppT,r] ,{i,10}]

the resultant graphs look like these, without manually adjusting each graph after simulation is complete?

enter image description here

so how can I set it such that the series of graphs will be consistent with my single simulation result plot size?

share|improve this question
4  
Its better to post code rather than images. – Andy Ross Jan 8 at 2:37
1  
What exactly do you mean by graphs will be consistent with my single simulation result plot size ? Do you mean just using ImageSize-> ? Please post complete self contained code that one can copy/paste and run. – Nasser Jan 8 at 2:39
Say a function I run once returns a window size of 200 x 200 pixels in size, is there a way to make the same window size of any plots when running the same function inside a Table loop, as it is hard to see the same result on a different scaling each time when I run different number of the same functions. – sebastian c. Jan 8 at 2:42
2  
As you insist on posting code as an image, which makes it non-copyable, and you refuse to learn how to format your questions, I'm voting to close as not a real question. In addition to the down vote, of course. – rcollyer Jan 9 at 6:13

2 Answers

p = Plot[Sin[x], {x, -Pi, Pi}, ImageSize -> 200]

Mathematica graphics

size = ImageSize /. FullOptions[p];
Table[Plot[Sin[x], {x, -Pi, Pi}, ImageSize -> size], {6}]

Mathematica graphics

share|improve this answer
Hi Nasser, is this a pre or post simulation option? It is because I have already ran my long simulations and prefer not to rerun these again. – sebastian c. Jan 8 at 3:05
hi, sorry, do not understand the question. You asked how to make the plots in table show up the same size as the one plot? Basically all what you have to do, is use the same image size that you used for the main plot. Need to specify an actual imagesize for the main one, else it will be Automatic. I am not familiar with what other setup you have there. You just need to use the same image size, that is all. – Nasser Jan 8 at 3:14
Hi Nasser, so inside my functionPlot: p=ListLinePlot[...]; size=ImageSize /. FullOptions[p] (plotting it once) and then when called by Table using Table[ functionPlot[], {i,6}, ImageSize -> pSize]. This gives me error of pSize at position 3 does not have the correct form for an iterator? Also size is still Automatic? I made size to be global as opposed to local variable. – sebastian c. Jan 8 at 4:19
You used ` ImageSize -> pSize` in the wrong place. It should be inside the Plot command that you use in the table. You need to pass it to your functionPlot[] if you are doing the plots inside a function. Do not pass it to Table as Table does not know anything about ImageSize – Nasser Jan 8 at 4:26
Also size is still Automatic you need to specify ImageSize in your main plot as I mentioned and show in the example. Otherwise, it will be Automatic. – Nasser Jan 8 at 4:50

I was going to suggest that if you had generated simulations/plots, you could reset the graphics options with Show:

Sims + incorrect plots:

sims = RandomReal[{0, 1}, {10, 200}];
plots = ListLinePlot[#,
  PlotLabel -> Style["Gaussian copula to 1st default spreads", FontSize -> 18]] & /@ sims

Reset options:

Show[#, PlotLabel -> Style["Gaussian copula to 1st default spreads", 
     FontSize -> Scaled[0.06]], ImageSize -> 800] & /@ plots

The only problem is that when I use a relative font size Scaled[0.06], which rescales nicely if you change the size of the image or use Export, extra white space is inserted around the graph, especially on the sides and sometimes on top.

Nasser is right about using ImageSize to control the image's size. Sometimes you have to use ImagePadding, too, if the ticks change width (because of a different number of digits or minus signs that come & go).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.