endangeredoxen / fivecentplots

A Python plotting analgesic
https://endangeredoxen.github.io/fivecentplots
11 stars 6 forks source link

I am not able to reduce the font size of groups values. #44

Closed frecloud closed 2 years ago

frecloud commented 2 years ago

I want to reduce the fontsize of overlapping values of 'RegWr00_DATAPEDESTAL' So that user can read the values clearly. I don't want to increase the ax_size[0], Just want to reduce the font size of these value to make them readable. I tried diff kwargs from doc but none of them isn't working. Thanks in advance, please assist me.

frecloud commented 2 years ago

Also I can't usetick_labels_minor_x_rotation=45 or tick_labels_major_x_font_color='#FF0000' why is that?

endangeredoxen commented 2 years ago

You can reduce the box label font sizes using box_group_label_font_size

import fivecentplots as fcp
from pathlib import Path
import pandas as pd
df = pd.read_csv(Path(fcp.__file__).parent / 'test_data/fake_data_box.csv')
fcp.boxplot(df, y='Value', groups=['Batch', 'Sample'], box_group_label_font_size=6)

custom_box_group_label_font_size

You can also set a new default in your theme file so you don't have to add this every time

https://endangeredoxen.github.io/fivecentplots/0.5.0/api/boxplot.html#boxplot

endangeredoxen commented 2 years ago

I have no issue changing the tick label color

fcp.plot(df, x='Voltage', y='I [A]', legend=['Die', 'Substrate'], ax_size=[400, 300],
              filter='Target Wavelength==450 & Temperature [C]==25 & Boost Level==0.2', 
              tick_labels_major_x_font_color='#FF0000')

but I'm seeing some weirdness with the minor ticks and will get back to you

tick_labels_font_color

endangeredoxen commented 2 years ago

If you get different results than what I posted above, please try to install fcp in a clean env. If it works there then you may have some issue in your current env

frecloud commented 2 years ago

It is working, thanks. One more thing, do we have something for rotation also for boxgroup..... ?

endangeredoxen commented 2 years ago

See the link I posted above. All kwargs are detailed in the API section of the docs.

Custom rotation of box labels is not currently supported. The default rotation is 0 deg. If the labels are too wide they will automatically rotate to 90 deg. Do you need this feature?

endangeredoxen commented 2 years ago

To get back to your tick question, the following should work:

import fivecentplots as fcp
import pandas as pd
from pathlib import Path
df = pd.read_csv(Path(fcp.__file__).parent / 'test_data' / 'fake_data.csv')
fcp.plot(df, x='Voltage', y='I [A]', legend=['Die', 'Substrate'], ax_size=[400, 300],
               filter='Target Wavelength==450 & Temperature [C]==25 & Boost Level==0.2', 
               tick_labels_major_x_font_color='#FF0000', tick_labels_minor=True, tick_labels_minor_x_rotation=45)

and indeed it does work--sometimes tick_rotation_minor

However, I can run the exact same block of code in the same python env and sometimes the ticks get mangled like this: ticks_bad

I don't know where this bug is coming from but will continue investigating

endangeredoxen commented 2 years ago

I have found and resolved this bug. The fix will be included in the beta of v0.5.0. Thanks