APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Question about EJS and Objects post and replies

Return to the Question about EJS and Objects thread
Login to post to this thread

Adjusting the font for plot axis labels
Larry Engelhardt
17 Posts

Is it possible to modify the font that is used for the axis labels of plots?

I see that PlottingPanel view elements have a setFont method, so I tried the following lines of code:

Font f = new Font(Font.SERIF, Font.PLAIN, 30);
_view.plottingPanel.setFont(f);

However, this does not seem to do it.

Thanks!


Replies to Adjusting the font for plot axis labels

Re: Adjusting the font for plot axis labels -
Francisco Esquembre
238 Posts

Larry,
The first answer is no. The PlottingPanel class doesn't provide this possibility. At least yet.
But we are having a second look. Maybe it is not too difficult to add it.
Paco



Re: Adjusting the font for plot axis labels -
Francisco Esquembre
238 Posts

Hi,
Because this solution was not satisfactory, we had to add a new feature.
The latest EJS releases, starting with EJS_4.3.5_120120, offer a new property for PlottingPanels called FontFactor. This factor multiplies the default font size of the axes labels to increase (factor > 1) or (decrease factor<1) the font displayed. Try 1.2 to increase, for instance. Do not use a 0 or negative factor!
Paco



Re: Adjusting the font for plot axis labels -
james adam (DS)
1 Posts

it should work... if dont... try this..

Font f = new Font(Font.SERIF, Font.PLAIN, 30);
_view.plottingPanel.setFont(f);




Modeling Agency
Modeling Agency in CA



Re: Re: Adjusting the font for plot axis labels -
Francisco Esquembre
238 Posts

I guess this will change some fonts in the panel, but not those of the axes labels...
I recommend using the new property for what Larry wants to do.

Paco



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book