enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.32k stars 286 forks source link

Title and label Font size of color bar #643

Open apapaion opened 6 years ago

apapaion commented 6 years ago

When I try to change the font size of the title or text of a colorbar, nothing happens. For instance, in the following example: `import numpy as np from mayavi import mlab

x, y, z = np.ogrid[- .5:.5:200j, - .5:.5:200j, - .5:.5:200j] r = np.sqrt(x 2 + y 2 + z 2) L = - r 3 / 6 + 5. / 2 * r 2 - 10 r + 6 Y = (x + y 1j) 2 * z / r ** 3

Phi = L Y np.exp(- r) * r ** 2

mlab.figure(1, fgcolor=(1, 1, 1), bgcolor=(0, 0, 0)) src = mlab.pipeline.scalar_field(np.abs(Phi)) src.image_data.point_data.add_array(np.angle(Phi).T.ravel()) src.image_data.point_data.get_array(1).name = 'angle' src.update() src2 = mlab.pipeline.set_active_attribute(src, point_scalars='scalar') contour = mlab.pipeline.contour(src2) contour2 = mlab.pipeline.set_active_attribute(contour, point_scalars='angle') mlab.pipeline.surface(contour2, colormap='hsv')

cb=mlab.colorbar(title='Phase', orientation='vertical', nb_labels=3) cb.label_text_property.font_family = 'times' cb.label_text_property.bold = 0 cb.label_text_property.font_size=24

mlab.show()

When Font_family and bold properties change, they affect the text in colorbar. However, this is not the case for the font size. Is it a bug or is there anything else that should be changed as well in order to change the font size in the colormap?

dakuhn commented 5 years ago

Today I was faced with the same problem, that helped me in my case: cb.scalar_bar.unconstrained_font_size = True then the font size can be changed: cb.label_text_property.font_size=24 but the font size will no longer scale automatically when the window size is changed.

mmlanger commented 5 years ago

Are there any news on this? I also face the problem that the label_text_property.font_size for a colorbar won't do anything, I'm on Windows 10 with the current mayavi from conda-forge.