The Open Source Physics website will be unavailable Friday evening through Saturday afternoon as electrical work occurs in the American Center of Physics server room. Down time will begin at 6PM Eastern Time on Friday. Service is expected to resume by 6PM on Saturday, July 30.

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 - Dec 11, 2011 at 2:32PM
Larry Engelhardt
15 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 - Dec 11 2011 5:30PM
Francisco Esquembre
207 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 - Jan 21 2012 12:18PM
Francisco Esquembre
207 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 - Jan 24 2012 7:54AM
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 - Jan 25 2012 4:18PM
Francisco Esquembre
207 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



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics