Closed jackreid closed 3 years ago
I had a lot of trouble implementing these in the ways that we had discussed. I think for both the y-axis limits and the map legends, I was unable to pass things through the entire flow in order to get them to work correctly.
As a quick fix for now, I implemented conditional statements to address both of these issues. For the y-axis limit, I used the following statement which determines whether or not to use the lower bound of zero based on the difference between the max and min values of the historical data. This seemed to work well for all the data in the Indonesia context, but let me know if it breaks for other contexts. if (np.nanmax(histval) - np.nanmin(histval)) < 0.5(np.nanmin(histval)): ax1.set_ylim(min(0.8np.nanmin(plotval), 0.8np.nanmin(histval)), 1.2max(np.nanmax(plotval), np.nanmax(histval))) else: ax1.set_ylim(min(0, np.nanmin(plotval), np.nanmin(histval)), 1.2*max(np.nanmax(plotval), np.nanmax(histval)))
For the map legends, I used the following statement: if minim < 0 and smallpos == []: colormap = cm.get_cmap('autumn', 48) elif minim < 0 and smallpos != []: colormap = cm.get_cmap('RdYlGn', 48) else: colormap = cm.get_cmap('YlOrRd', 48)
This seems to change the direction of the legend appropriately for the Indonesia cases, but let me know if it doesn't work for other contexts.
These changes are currently pushed to Shealombardo
I like these changes. They significantly improve readability for the graphs and the maps, for all the contexts as far as I can tell. I still want to have functionality of manually setting visualization parameters, but your changes will be the default in absence of such parameters. This is based not so much out of a desire to set visualization parameters at the moment, but I think that we may be making changes in the future of various kinds, I want to have the groundwork laid for that.
To this end I have added such functionality, and it can be seen in the graph_bounds branch.
For the temporal graphs, SD_object has a new keyword 'visualization' which is used to define two attributes 'vismin' and 'vismax' which are checked for in make_fig. You can see an example of how it looks by looking at the 'Brazil Unemployment Rate' in the Rio de Janeiro context.
For the geographic data, each shp_fields object now has three additional columns: VisMin, VisMax, and VisColor, which set the minimum, maximum, and colormap for the map, respectively. You can see an example of it in action for the 'Relative Humidity' field in the Rio de Janeiro context.
If this looks good to you, we can merge this into SheaLombardo and master.
These changes sound sane to me, but I have a very novice question: How do I pull branches that I didn't create? Currently on my machine I only have the SheaLombardo and Master branches, and I can't figure out how to pull down a branch that you made?
I think the below should get your computer to get all of the branches that are on the github repository. Then you can checkout and pull them as normal.
git fetch --all
I realized that two separate issues, #33 and #24 , could perhaps be solved with the same method. The proposal is as follows:
Does this sound reasonable?