sciapp / python-gr

Python wrapper for the GR framework
https://gr-framework.org
Other
30 stars 8 forks source link

label size in pygr.Plot #24

Open nilsbecker opened 3 years ago

nilsbecker commented 3 years ago

hi, it seems that here the font size at which labels are drawn is set to a fixed multiple of the height of the plot window in normalized device coordinates.

it should be made possible somehow to adjust that.

concrete example: i am trying to produce a non 1:1, landscape-format plot. the only way i found to achieve that was the cumbersome method:

    window_cm = np.array([0., 20, 0, 10])
    gr.setwsviewport(*(1e-2*window_cm))  # screen window size in meters
    gr.setwswindow(0, 1, 0, 0.5) # rect in NDC coords to be scaled to the workspace window
    p = Plot(viewport=(.1, .95, 0.05, .45)) # padding of plot into that rect
    p.xlabel = 't'
    p.ylabel = 'mol number' # it seems currently impossible to change label size.

this means the NDC height is now only 0.5 instead of 1, so that my axis labels now come out as half the font size of the usual case with 1:1 aspect plots, with apparently no way to change that.

edit: