cpmech / plotpy

Rust plotting library using Python (Matplotlib)
MIT License
65 stars 6 forks source link

Can the font size be adjusted in each kind of plots? #69

Closed supernova4869 closed 2 months ago

supernova4869 commented 2 months ago

Sorry for the basic question, but I did not find the details in the documents and also not found methods like plot.set_font(). How could I change the font size in, for example, bar plot?

    let mut bar = Barplot::new();
    bar.draw(&times, &values);
    let mut plot = Plot::new();
    if cfg!(windows) {
        plot.set_python_exe("python");
    }
    let def_name = format!("MMPBSA_{}_ΔH_traj.png", sys_name);
    plot.add(&bar)
        .set_label_x("Time (ns)")
        .set_label_y("Binding Energy (kJ/mol)")
// .set_font(20)
        .save(&wd.join(&def_name)).unwrap();
cpmech commented 2 months ago

Hi, this is now implemented in version 1.7.1. For example:

    // set font size of labels and ticks
    plot.set_label_x("x axis")
        .set_label_y("y axis")
        .set_label_x_fontsize(20.0)
        .set_label_y_fontsize(30.0)
        .set_ticks_x_fontsize(15.0) // ticks
        .set_ticks_y_fontsize(8.0); // ticks
supernova4869 commented 2 months ago

Thank you for the update!