Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional plot library? #204

Open
tcld opened this issue Nov 18, 2015 · 6 comments
Open

Optional plot library? #204

tcld opened this issue Nov 18, 2015 · 6 comments

Comments

@tcld
Copy link
Contributor

tcld commented Nov 18, 2015

Since we already have @esampson's scatter plot and since I have been trying to add something similar, too - would it maybe be a good idea to move the plot-functions into their own module and make use of a proper plotting-library? I think it could be an optional dependency since it will only interest a few people.

The library I have stumbled upon the most is matplotlib; the code seems to be simple and there are a million examples that would hopefully make it very easy to make use of the library.

This could be used in conjunction with numpy.histogram, so certain plots could be done very quickly and within a few lines of code.

@esampson
Copy link
Contributor

Yeah. I'm all for moving it to a separate module. As mentioned earlier I would kind of like to offload all drawing to separate modules and give people complete control over what drawing modules are called or not called (with the addition that we put a group of modules in as the default options so that new users don't generate only a world file and then wonder what to do with it).

@tcld
Copy link
Contributor Author

tcld commented Nov 18, 2015

Topical separation sounds good, but a module for every drawing function might be overkill. Aside from the ancient map-drawing (which occupies its very own module already) none of it is complicated enough to justify its own module, in my opinion. You would just be left with a lot of files and imports. If WorldEngine were to grow a lot, though, separation might become an important topic.

If you want to give control to the user, let's start working on a well-documented file that contains all the variables used during generation and drawing. That would increase control tenfold and make things a hundred times easier for people who aren't familiar with the code or Python in general.

And on topic: Moving things to something like draw_plots.py would be a start, but I would really like to see proper plots with labeled axes etc.

@ftomassetti
Copy link
Member

I would make dependencies optional only if the involve native libraries, otherwise pip can install stuff quite easily and having the extra complication of optional stuff could be not worthy.

I suggest we start moving stuff to draw_plots.py. Later we may create a subdirectory named plots with:

  • plots/general.py
  • plots/scatter_temp_hum.py
  • plots/other_plot.py

But probably we will able to understand what to generalize when we start having more than one plot.

As we produce more output we should probably think about better options to control it. Something like:

  • --all-plots
  • --no-plots
  • --scatter-temp-humidity=YES/NO

And perhaps some plots enabled by default.

@tcld
Copy link
Contributor Author

tcld commented Nov 19, 2015

I don't even know if matplotlib uses any native libraries. But I will find out once it is necessary. As soon as some other PRs are out of the queue, I will move things to a draw_plots-module.

@tcld
Copy link
Contributor Author

tcld commented Nov 19, 2015

It seems that matplotlib might not be trivial to install, although pip install matplotlib worked for me (for both Python 2 and 3). On top of that, the matplotlib-package is quite large (54 MB) - I'm not sure if that factors in to anything.

So maybe a different plotting library would be better? Until then I will try to look at matplotlib a bit more.

@tcld
Copy link
Contributor Author

tcld commented Nov 19, 2015

Well, it looks quite nice.
hypsographic_28070

Here the original from http://www.ngdc.noaa.gov/mgg/global/etopo1_surface_histogram.html:
Earth

Also, something like this could be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants