Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upoutputlib - basic plots #36
Comments
ckaldemeyer
added
enhancement
question
feedback wanted
labels
Dec 23, 2015
ckaldemeyer
self-assigned this
Dec 23, 2015
ckaldemeyer
added this to the January 2016 Release milestone
Dec 23, 2015
This comment has been minimized.
This comment has been minimized.
@ckaldemeyer wrote:
No, so far the devplots module is based on the pandas plotting functions and not on basic matplotlib. The idea was to create a plotting library based on the EnergySystem class to make it easy to get default plots, so that people do not have to spend time on programming plots again and again. @ckaldemeyer It would be helpful if you add you ideas to this library. |
This comment has been minimized.
This comment has been minimized.
@uvchik : I'll push my state tomorrow. It took a bit longer dealing with a pandas MultiIndex (http://pandas.pydata.org/pandas-docs/stable/advanced.html) but I think it's worth spending time on it! |
This comment has been minimized.
This comment has been minimized.
Multiindexing looks pretty cool to me, especially as we always have tuples as sets for optimization model. |
This comment has been minimized.
This comment has been minimized.
Have a look at the features/pypower branch. There, the energy system class has a method to plot itself as graph. This could be a blueprint for plotting functions. |
This comment has been minimized.
This comment has been minimized.
I can't find it there. But I am almost done and we can still adjust it later |
This comment has been minimized.
This comment has been minimized.
I'm not sure if this is the proper thread to address this issue, but within the RLI oemof team we discussed last summer a budget for support in data processing and results analysis (including plotting). Due to organizational problems this has not been realized so far, but popped up again today and seems still relevant. We have now a student who is interested in doing this and I have to clarify the budget once more. This just as an information.. if it's not right here, please move this comment or tell me :-) |
This comment has been minimized.
This comment has been minimized.
I have pushed my current state to "features/outputlib-based-on-pandas" and adjusted the storage optimization example to show how it works! Make sure that your pandas version is >= 0.17.0. Otherwise the multiindex will fail.. There is still some stuff to do (see TODOs) but I think that at least the idea gets clearer. At the moment I am not sure if it is really necessary to write more plotting functions as it is more or less just a "passing through" of parameters and plots are always individual and a matter of taste. Maybe instead of this some "slicing methods" that return pre-formatted dataframes for different purposes would also do the job. But that's more for the discussion.. |
This comment has been minimized.
This comment has been minimized.
I have tested the code with renpass-gis as well and it seems to work fine. Only the dataframe takes some time being created in the beginning. But it is still quite fast and can be improved.. |
This comment has been minimized.
This comment has been minimized.
@caro-rli : Does it mean someone at the RLI gets paid to improve our plotting-/result-code? This would be great ;) |
This comment has been minimized.
This comment has been minimized.
I tested your to_pandas module. I don't understand why you changed the example instead of just using the EnergySystem class. I added this possibility and reverted the storage example to the old version. Now both plots work. Revert the commit if you don't like it. I will read more about the multiindex and maybe i can adapt my plot to this DataFrame. I still like the combination of bar and line plots to check the results but this is a matter of taste. If the multiindex DataFrame proves its value in the long run the method to create it could be part of the EnergySystem class (convert_results_to_dataframe). |
This comment has been minimized.
This comment has been minimized.
That's fine. Go ahead |
This comment has been minimized.
This comment has been minimized.
Bar and line plots can still be plotted easily. From my opinion some slicer-methods that convert subsets of the multiindex df into preformatted easily plottable dataframes should be enough including one or two common standard plots (e. g. power versus time and annual sums). The preformatted easily plottable dataframes can then be plotted with individual styles as described here (see here http://pandas.pydata.org/pandas-docs/stable/visualization.html) or using matplotlib. In my opinion, only the slicer-methods and one or two standard plots should be part of the framework. Further plotting could then be done on app-level by extending the class and doesn't blow up the code which also has to be adapted to every change.
Either here or in the class as it is now. We should discuss that! |
This comment has been minimized.
This comment has been minimized.
I think the only thing that is missing now is a implementation of a stacked plot with steps. This is something pandas plotting does not easily provide, but I think we need it as we are discrete in terms of our timesteps. (setting kind="area" in the df.plot() method for instance doesn't satisfy me...) |
This comment has been minimized.
This comment has been minimized.
No, that's something I see as well. I'll see if I can sort out something on Friday using pandas as well. Otherwise it will be matplotlib but based on a well pre-formatted dataframe. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think now I fully understand the idea of the Multiindex DataFrame. Thank you. For me it looks good.
I agree that we should not add too many plots to the library. Maybe we could create a gallery with nice plots based on the EnergySystem class or the Multiindex DataFrame (like matplotlib, just smaller: http://matplotlib.org/gallery.html). But it helps if some plots are ready to use within the outputlib. Printing the results is missing in the example file, but maybe it should also use the Multiindex DataFrame. |
This comment has been minimized.
This comment has been minimized.
To me it looks good. I wouldn't have expected it to be so easy. Thanks!
Thanks.
In my opinion, the name depends on what it is supposed to be. For me, the class provides a structured and easily usable data structure for results with an additional printing option. Thus, for me it's less plotting than structuring results. But it should be discussed. Any suggestions for a good name?
What about the others? Do you think this is a good way to go? |
This comment has been minimized.
This comment has been minimized.
Just in case we go this way, here are some TODOs from my side:
|
This comment has been minimized.
This comment has been minimized.
Good idea but at least for the stackplot we have to differ between plot options and options for the stackplot method. So we still need something like
We decided to use numpydocs and they use
I think we should use the
The idea is that you can easily plot a combined plot: fig = plt.figure(figsize=(24, 14))
# First part
ax = fig.add_subplot(2, 1, 1)
es_df.stackplot(bus_uid="bel"....)
# Second part
ax = fig.add_subplot(2, 1, 2)
es_df.stackplot(bus_uid="bheat"....) But I can divide it into two methods and allow both ways. Okay? |
This comment has been minimized.
This comment has been minimized.
Sounds good! |
This comment has been minimized.
This comment has been minimized.
I have just talked to Günni and there are still two more entries missing in the dataframe. Update in TODO-list:
|
referenced
this issue
Jan 8, 2016
referenced
this issue
Jan 8, 2016
This comment has been minimized.
This comment has been minimized.
Here's the updated TODO-list:
Additionally, I have added the possibility to create the dataframe only for specific busses/bus types by passing a list of uids/types. |
This comment has been minimized.
This comment has been minimized.
Oh, I have just read my mails and saw your pull request. Anyhow, we are making progress here ;) |
This comment has been minimized.
This comment has been minimized.
My Todos for today are finished:
|
This comment has been minimized.
This comment has been minimized.
We still have to find a name for the class that builds the dataframe and provides some basic plots. Even though I'm already used to it, I think |
This comment has been minimized.
This comment has been minimized.
@ckaldemeyer : Please update the requirements in the setup.py. Actual it is |
This comment has been minimized.
This comment has been minimized.
Done. But the storage invest example is not working anymore. I am already searching for the error.. |
This comment has been minimized.
This comment has been minimized.
I would leave them out. For me it should be lean and provide basic plotting. Everything beyond requires the user to look deeper into pandas/matplotlib anyway. |
This comment has been minimized.
This comment has been minimized.
What about solph_results_to_pandas ? Basically this it what it does ;-) |
This comment has been minimized.
This comment has been minimized.
Works now. The error was
Probably from your testing procedures. |
This comment has been minimized.
This comment has been minimized.
Sorry, I fixed it in the |
This comment has been minimized.
This comment has been minimized.
But it also provides basic plots. What about |
This comment has been minimized.
This comment has been minimized.
I'm not talking about the pandas arguments but the parameters we set within our method such as |
This comment has been minimized.
This comment has been minimized.
For me it is not necessary. But go ahead if you want. |
This comment has been minimized.
This comment has been minimized.
Then I would prefer |
This comment has been minimized.
This comment has been minimized.
Btw: Should we delete the features/outputlib-with-pandas branch and create a new one for further developments? |
This comment has been minimized.
This comment has been minimized.
That is really funny. Of course it is not necessary for you. You wrote it. |
This comment has been minimized.
This comment has been minimized.
Agree with closing the branch. For me we can leave the name as it is and let somebody else find a new name. I think we did a lot service for users/developers who want to plot. Thank you for your work. I would also close this issue and start a new one with the remaining ToDos if there are any. |
This comment has been minimized.
This comment has been minimized.
I have just fixed an issue that occured with renpassgis on the dev branch. I'll close this issue and remove the branch, too. Thank you and Simon for your contributions! |
ckaldemeyer commentedDec 23, 2015
Uwe has already started with his outputlib and created a method which creates a dataframe with all component timeseries arround a given bus.
He started with basic matplotlib which has all configuration options but in my opinion sometimes to many for standard plots as it is overwhelming...
After some trying my idea would be to go with the pandas basic plotting functions (based on matplotlib) for the basic plotting functions and the plots for renpass-gis.
Here's a small example with a handfull of plots and some possible configuration options beyond the standard functionalities (needs matplotlib >= 1.4):
It would be quickly implemented on top of Uwes work and should fulfill most needs as I do not want to spend too much time on visualisation tweaking.
@oemof/oemof-main
Whats your opinion on this?
Happy christmas
Cord