18
$\begingroup$

How can I find the default font parameters (family, size, etc.) for the text that appears in Graphics produced by Plot, ListPlot, LogPlot, etc.?

I'm interested not only in the font specs used for axis and plot labels, but also (and importantly) in those for the numbers displayed next to tick marks.

EDIT: At the moment there appears to be two entirely different ways to set these parameters, and it is not clear to me which one takes precedence. One, suggested by ybeltukov, is through Format->EditStylesheet.... The other one, described in the post linked to by Kuba, is through SetOptions[Graphics, BaseStyle -> {...}].

$\endgroup$
0

2 Answers 2

20
$\begingroup$

Font family, size, etc. depends on "Graphics" style in the notebook stylesheet

CurrentValue[{StyleDefinitions, "Graphics", "FontSize"}]
 (* 10 *)

CurrentValue[{StyleDefinitions, "Graphics", "FontFamily"}]
 (* "Times" *)

You can manually change it: open Format->Edit Stylesheet..., add

 Cell[StyleData["Graphics"],FontSize->20]

and press Ctrl+Shift+E. You will see that the font in Plot,LinePlot, etc. instantly increase.

Edit: default values for Plot, ListPlot, etc. separately can be set by

SetOptions[Plot, BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 16}]
$\endgroup$
6
  • $\begingroup$ So I was wrong. Thanks, I wasn't paying attention to StyleDefinitions :) You can mention the TraditionalForm for Labels issue. Also, one have to be aware the SetOptions is sometimes tricky - How can I... $\endgroup$
    – Kuba
    Commented Sep 5, 2013 at 21:07
  • $\begingroup$ @Kuba What is Labels issue? Both methods (SetOptions and edit stylesheet) work for plot and axis labels. $\endgroup$
    – ybeltukov
    Commented Sep 5, 2013 at 21:20
  • $\begingroup$ That labels are by default in TraditionalForm. I know SetOptions will work here but just to point out it is not always work for other functions. I find your answer great, those are just details. $\endgroup$
    – Kuba
    Commented Sep 5, 2013 at 21:31
  • $\begingroup$ @Kuba Can you give an example? I've noticed that if I change TraditionalForm style, it overwrite Graphics style for plot and axes labels and numbers on axes. Moreover, there are GraphicsLabel style, which affects axes labels and numbers (not plot label!). $\endgroup$
    – ybeltukov
    Commented Sep 5, 2013 at 22:02
  • $\begingroup$ I was referring to PlotLabel > Details. $\endgroup$
    – Kuba
    Commented Sep 5, 2013 at 22:17
2
$\begingroup$

I figured this out quite by accident, and I will show you why, but the short answer to your question is to Find the length of the command and then display that. For example, consider the plot function.

 In[50]:= Length[Plot[x, {x, 0, 1}]]

 Out[50]= 2

Now we can look at these two elements and you will see all:

You can see the hue (Hue[0.67, 0.6, 0.6]) of the classic blue line in

 Plot[x, {x, 0, 1}][[1]]

You can see all sorts of other hidden details in

 Plot[x, {x, 0, 1}][[2]]

For example, the default aspect ratio is 1/GoldenRatio.

I will show you how I found this, why, and how I changed a function that I could not otherwise change. I was trying to make polyhedral nets, and the function

 PolyhedronData["Disphenocingulum", "NetImage"]

gives a net, but there is no way to change this baby barf yellow color. What I did was this. I computed and looked at

 PolyhedronData["Disphenocingulum", "NetImage"][[1]]

I saw that this ugly yellow was RGBColor[1, 1, 0.85]. I replaced the regular polyhedron data function with

 Graphics[
 ReplacePart[
 PolyhedronData["Disphenocingulum", "NetImage"][[1]], 
  1 -> FaceForm[RGBColor[1, 1, 1]]]]

Eureka, I made the background white and never gave it a second thought until today. I feel like I answered your question. As for me, I had no choice but to find these hidden details, as I could not figure out how to manipulate the built in function otherwise.

I think this method should show the hidden guts of pretty much every function you have in mind.

$\endgroup$
3
  • 4
    $\begingroup$ try FullForm, such as Plot[Sin[x],{x,0,2 Pi}]//FullForm $\endgroup$ Commented Sep 5, 2013 at 20:27
  • $\begingroup$ Hah! Dirk that is indeed a much faster way. I see all. Very good. $\endgroup$ Commented Sep 5, 2013 at 20:33
  • 5
    $\begingroup$ InputForm is very useful too for examining graphics expressions, it's easier to read than FullForm. $\endgroup$ Commented Sep 5, 2013 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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