PaperSize option for Gnuplot in fitting fonts? - plot

I used to set PaperSize in Matlab to control the font size in different axis.
This is better than directly changing the fontsize.
I think this kind of procedure can be working for gnuplot too.
Here some overview of papersize in Matlab.
An unanswered question here in SO about setting fontsize with partisan view how to do it.
So Matlab's command
set(hFig, 'PaperSize',[X Y])
Is there any similar way to control the papersize in Gnuplot as Matlab?
I want to get consistent font sizes in my plots.

You can set the overall image size with the terminals size option like
set terminal pdfcairo size 21cm,29.7cm

Related

Change plot window size in Julia notebook

I am using Julia notebook and making plots using basic Plots package.
A plot looks good, except its entire size.
I can change the plot size and font size of labels individually. But it becomes less readable unless I change the font size and line width for every component.
So is there a way to change the size of a plot as a whole? I also hope I can change it by default.
To answer your original question in the title, you can change the size of the Plot Window by specifying the size attribute as you already are in your code. See here: http://docs.juliaplots.org/latest/basics/ for more details.
As pointed out by Rashid, you can use the scalefontsize function to scale the font size. You can also scale the thickness by setting the thickness_scaling attribute, see here for more details: http://docs.juliaplots.org/latest/generated/attributes_plot/
To be clear, there is not currently a unified way to scale a plot in the way you are looking for it right now, it has to be done manually (though it would be great to have this unified scaling). I opened a feature request for this here: https://github.com/JuliaPlots/Plots.jl/issues/3153

How to scale the fontsizes using Plots.jl

is there a way to rescale all the fontsizes (legend, tickslabels, axislabels…) at once?
Original question from Filippo Vicentini on Slack.
Individual font sizes can be controlled with the titlefontsize, tickfontsize, legendfontsize, tickfontsize, guidefontsize and legendtitlefontsize attributes, but I get that this can be quite tedious.
There is also the thickness_scaling attribute.
plot(rand(10), thickness_scaling = 0.5)
However, this also affects the line widths.
The third option is to call
Plots.scalefontsizes(α)
to scale all font sizes by a factor α. This changes the global fontsize defaults for all subsequent plots and can be undone with
Plots.scalefontsizes(1 / α)
Answer by Daniel Schwabeneder on Slack.

Change the font size in a seaborn corrplot

My question is how to change the size of font in seaborn using correlation matrix I don't know why somehow the font is too large for me
if you already have the correlation values in your data, you can use a heatmap and set up the size with "annot_kws", for example here setting it to 8.
sns.heatmap(data, vmin=data.values.min(), vmax=1, square=True,
linewidths=0.1, annot=True, annot_kws={"size":8})
and it would look like this:
Regrettably I don't think that's configurable, but what I would recommend is just to make the figure larger e.g.
f, ax = plt.subplots(figsize=(10, 10))
sns.corrplot(df, ax=ax)
If that's not an option and you're primarily interested in the heatmap (not the numerical values), you could do
sns.corrplot(df, annot=False, sig_stars=False, diag_names=False)
I believe you can use the set method, modify the font scale parameter.
sns.set(font_scale=0.5)
If you're using set_context, then you can add a font scaling parameter along with the size of the plot.
sns.set_context("poster",font_scale=.7)
i did this at this works quite well.
enlarged the fig size to able to read it properly
sns.set(style="white")
f, ax = plt.subplots(figsize=(20, 20))
sns.heatmap(bos.corr(),annot=True,annot_kws={"size":15})

Rstudio: how to control default point size in plots?

Is there an Rstudio-specific way to specify the default font size? Since Rstudio has other panels that use up space, I'd like to have a smaller font size than I would have for other ways of using R.
Go to Tools | Options | Global Options. There you can set the font. As far I can tell this persists between sessions.
Also see here.
RE #Dank's note: sorry, I see now that you mentioned plots in the question.
I think this cannot be controlled globally in RStudio, but depends on the specific graphics package you are using. So using plot(...) in base R you would use:
par(ps=10) # default starts out at 12
This sets the default point size to 8 points until you use par(...) again.
If you are using ggplot, see this link.
Hope this helps.
You may use teh parameter cex , for example
cex=0.7
it decreases the font relatively to the default font.

specifying font size in R figures

Is there a method for specifying the font size in when producing figures in R. This seems like a really basic requirement but I can't seem to find any references to somewhere that specifies the font size. I can save a figure to a pdf as follows:
setwd("C:\\")
pdf(file="Plot.pdf",family="Times")
plot(x,y);
dev.off()
Where R basically generates the figure in the pdf not in the figure window. When I look for ways of altering the font size all I see is people referring to cex=1.5 argument to scale fonts 150 percent, and cex.lab, cex.axis, etc ... Although not being an immediate issue now, I do wonder what will happen when I publish some results and the journal requires font size between 9 and 11. How do I control these in R? Any suggestions would be appreciated.
You control the font size with the ps (point size) parameter. The default is typically 12 (but can be controlled globally for a PDF file by the pointsize parameter) so if you want, let's say, fonts of the size 10 for a particular text you would use par(ps=10); text(...). Since you mentioned cex: note that cex is relative to the current pointsize and also applies to symbols whereas ps specifically applies to text. Obviously, the size will only match as long as you don't resize the resulting figure.

Resources