svdhoog / FLAViz

FLAViz: Flexible Large-scale Agent Visualization Library
GNU General Public License v3.0
1 stars 4 forks source link

Plot output: filename and format #24

Closed svdhoog closed 5 years ago

svdhoog commented 6 years ago

Currently files are enumerated after the user-specified string in the plot_config.yaml. Better would be:

  1. Since output for different plot styles are already sorted into different subfolders (Timeseries, Histogram, etc.), the default filename should indicate the agent type and the variable name:

plot_name='Agent_Variable.png'

  1. Would also be great to have output in PDF format. This requires a setting in plotconfig.yaml

plot_format=[pdf|png]

0xfabi commented 6 years ago
  1. Right now the plot name is hardcoded in the plot_config.yaml. Do you want it to be generic and set by the script itself? Example: agent: Firm, var = [price,total_debt,technology] => Firm_price.png, Firm_total_debt.png, Firm_technology.png?

Otherwise we could rename it hardcoded to: Firm_price_total_debt_technology.png and for multiple variables we get: Firm_price_total_debt_technology_0.png, Firm_price_total_debt_technology_1.png, ...

svdhoog commented 6 years ago

Yes, option 1 is exactly what I meant.

0xfabi commented 6 years ago

Now the plot name is generic generated but no more hardcoded in the plot_config.yaml In addition I have added the plot_format parameter. You can choose between: png, pdf, ps, eps and svg (see here https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html)

svdhoog commented 6 years ago

Good, thanks! I guess this means that in principle we should then remove all the settings for plot_name on the readme page

https://github.com/svdhoog/FLAViz/blob/master/docs/visualisation_scripts/readme.rst

This would also mean that the files in the results folder now have changed to the generic names. However, for the readme page we actually refer to another folder than the results folder, so all links still work (luckily):

https://github.com/svdhoog/FLAViz/tree/master/docs/visualisation_scripts/plots

I would leave it like it is for now. The examples are still correct, since we can always override the generic name setting by explicit names, correct?

0xfabi commented 6 years ago

I've already edited the readme and removed all plot_name parameters. Also I've added plot_format as new parameter.

Right now there is no option for setting plot name manually. I can add that if you like. We could check if there is a plot_name set. Then it's explicit and otherwise we use the generic name which is autogenerated.

svdhoog commented 6 years ago

Yes, probably good to have a manual plot name option, just in case the generic naming causes problems in some cases.

0xfabi commented 6 years ago

Option was added again. If you do not set it, the plot name will be autogenerated.

svdhoog commented 6 years ago

Problem plot type histogram

Eurostat_unemployment_rate_set_841_1000_runs_histogram.png_unemployment_rate.png

This is generated when I set:

plot_name: Eurostat_unemployment_rate_set_841_1000_runs_histogram.png

So it appends _unemployment_rate.png to whatever string is passed to plot_name

svdhoog commented 6 years ago

Problem plot type Time series

plot3:
    timeseries:
        agent: Eurostat
        analysis: multiple_run
        variables:
            var1: [unemployment_rate]
        set: [841,842]
        run: [range,[1,10]]
        major: [range,[6020,26000,20]]
        minor: [0]
        summary: custom_quantile
        quantile_values:
            lower_percentile : 0.20
            upper_percentile : 0.80
plot3:
    number_plots: many
    plot_name: Eurostat_set_runs_timeseries
    plot_title: Unemployment rate (monthly), sets 841-842
    plot_legend: no
    fill: yes
    legend_location: best
    xaxis_label: month
    yaxis_label: unemployment rate
    linestyle: solid
    marker: None
Eurostat_set_runs_timeseries_0.png

Eurostat_set_runs_timeseries_1_1.png
...
Eurostat_set_runs_timeseries_19_19.png

TODO

svdhoog commented 5 years ago

Filenames are now uniform:

If no filename is specified in plot_config.yaml, then use "Agent_Variable", else use whatever is user-specified.

For filenames in many plot mode:

Resolved in commit d585600