Closed DStamatis closed 4 months ago
Thank you for the suggestion @DStamatis. We'll look at feasibility in our next development meeting and see if we can implement quickly. I can imagine an argument, y_minor_ticks = False
by default, but if set to True
, it would label the axes as per the current Pyleoclim style (e.g. journal, notebook, or other). It won't make sense for large stacks (what stackplot was designed for), but for a small one like this, it would add value.
OK, I have a prototype working. @DStamatis Is this what you had in mind?
It's going to get very unwieldy with many series, but you can try it out with 5 on your code and let us know how you like it. All you need to do is install the package from the newest branch:
pip install git+https://github.com/LinkedEarth/Pyleoclim_util.git@stackplot_yticks
Hello,
The plot looks great. I encountered a small problem after installing the new package from the new branch. I am using a jupyter notebook. Specifically, I used the following code:
ts_final = [benthic,CO2,dD,MIS7_1_series,MIS7_series, δ18O, NINO3] ms_final = pyleo.MultipleSeries(ts_final)
fig, ax2 = ms_final.stackplot_yticks(figsize=[5, 10], savefig_settings=None, xlim=None, fill_between_alpha=0, colors=None, cmap='tab10', norm=None, spine_lw=1.5, grid_lw=0.5, label_x_loc=-0.15, v_shift_factor=0.75, linewidth=1.5)
The result I get is:
AttributeError Traceback (most recent call last) Cell In[116], line 1 ----> 1 fig, ax2 = ms_final.stackplot_yticks(figsize=[5, 10], 2 savefig_settings=None, 3 xlim=None, 4 fill_between_alpha=0, 5 colors=None, 6 cmap='tab10', 7 norm=None, 8 spine_lw=1.5, 9 grid_lw=0.5, 10 label_x_loc=-0.15, 11 v_shift_factor=0.75, 12 linewidth=1.5) 14 # Highlighting interstadial 7d and 6e 15 ax2=pyleo.utils.plotting.make_annotation_ax(fig, ax2, ax_name = 'highlighted_intervals', zorder=-1)
AttributeError: 'MultipleSeries' object has no attribute 'stackplot_yticks'
Am I doing this correctly?
Best, Dionysios Stamatis
From: Julien Emile-Geay @.> Sent: Thursday, June 27, 2024 12:46 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
OK, I have a prototype working. @DStamatishttps://github.com/DStamatis Is this what you had in mind? stackplot_detailed.png (view on web)https://github.com/LinkedEarth/Pyleoclim_util/assets/13760223/d08a2c2d-fb09-4f3d-8cb2-b64268852f6a
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2195303658, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZYS4I6QJHO7X3IZI53ZJRFWTAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJVGMYDGNRVHA. You are receiving this because you were mentioned.Message ID: @.***>
Hi Dyonysos,
the function is still called stackplot()
, so that is your problem. "stackplot_yticks" is just the name of the branch in which this new code is published. Have a try and let me know ; I don't know if anyone has ever customized a stackplot this much, so this is a good test of our infrastructure!
Hi,
I may be doing this the wrong way. I ran the code with two datasets, the benthic stack and the δD record from EPICA Dome. It seems it is not working. The new package seems to be installed when I check, so I don't think that this is the problem. Can I have an example of a code with the yticks function? Here is the code:
ts_final = [dD, benthic] ms_final = pyleo.MultipleSeries(ts_final)
fig, ax2 = ms_final.stackplot(figsize=[5, 10], yticks = True, savefig_settings=None, xlim=None, fill_between_alpha=0, colors=None, cmap='tab10', norm=None, spine_lw=1.5, grid_lw=0.5, label_x_loc=-0.15, v_shift_factor=0.75, linewidth=1.5) Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Julien Emile-Geay @.> Sent: Thursday, June 27, 2024 6:43:28 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
Hi Dyonysos, the function is still called stackplot(), so that is your problem. "stackplot_yticks" is just the name of the branch in which this new code is published. Have a try and let me know ; I don't know if anyone has ever customized a stackplot this much, so this is a good test of our infrastructure!
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2195837465, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ5ZKBE7E3WM5SAN44LZJSPSBAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJVHAZTONBWGU. You are receiving this because you were mentioned.
I don't have access to your data, but here's an example with two pyleoclim datasets:
import pyleoclim as pyleo
LR04 = pyleo.utils.load_dataset('LR04')
dD = pyleo.utils.load_dataset('EDC-dD').convert_time_unit('ky BP')
ms = LR04.flip() & dD
ms.common_time().stackplot(labels=None, ylabel_fontsize = 12,
yaxis_style = 'detailed')
You should get something like this :
The critical argument for what you want to do is yaxis_style = 'detailed'
Hi,
The code works like a charm. However, I did need to change the v_shift_factor to 0.90 instead of 0.85, as the plots started to merge when I added two more datasets. It might be helpful to emphasize this adjustment in any example you upload. I also have a general request from the pyleoclim team. If possible, could you release videos or more tutorials on using the pyleoclim package? This would greatly benefit students like me. Coming from a place where coding isn't taught, I've been learning through trial and error. Many publications don't share the code used to create their graphs, which I believe is a significant oversight in the paleoclimate community. Sharing code would enable young students to learn and perhaps develop new methods to advance the field. I apologize for the lengthy message. Personally, when I publish my work, I will cite your package and release my code to help other students like me. Best regards, Dionysios Stamatis
From: Julien Emile-Geay @.> Sent: Friday, June 28, 2024 2:01 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
The critical argument for what you want to do is yaxis_style = 'detailed'
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2197471321, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ4BTX7BRAAP2OFKRRDZJWXHXAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGQ3TCMZSGE. You are receiving this because you were mentioned.Message ID: @.***>
Hi, The code works like a charm. That's what we like to hear! However, I did need to change the v_shift_factor to 0.90 instead of 0.85, as the plots started to merge when I added two more datasets. It might be helpful to emphasize this adjustment in any example you upload.
Sure, I put a warning in the docstring. Perhaps now you understand better why the default is minimal?
I also have a general request from the pyleoclim team. If possible, could you release videos or more tutorials on using the pyleoclim package? This would greatly benefit students like me.
We have been planning on doing short "how-to" videos for a while, but we would appreciate user requests on where to start! Re: tutorials, we are updating the PyleoTutorials to be compliant with the latest code, as they were last updated last year.
Thank you for your response. I forgot to mention one last addition that might be helpful for the stackplot. I believe that the stackplot would become even better if there was an option to add more tick marks on the x-axis. If that is possible, I believe the stackplot will be publication material.
As for where to start with "how-to" videos. I believe "how to make a publication level stackplot" is the best choice. They might be simple, but everyone uses them in the Paleoclimate community.
Then, just from personal experience and my studies at American and European Universities. I would make a few videos on spectral, PCA and wavelet analysis. Starting from how to prepare the data in a csv or excel file to how to interpret that data. These topics might be taught at several Universities, but rarely in a programming environment. A good addition would also be advice on when to use them and when not to use them.
Best regards, Dionysios Stamatis
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Julien Emile-Geay @.> Sent: Monday, July 1, 2024 6:30:33 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
Hi, The code works like a charm. That's what we like to hear! However, I did need to change the v_shift_factor to 0.90 instead of 0.85, as the plots started to merge when I added two more datasets. It might be helpful to emphasize this adjustment in any example you upload.
Sure, I put a warning in the docstring. Perhaps now you understand better why the default is minimal?
I also have a general request from the pyleoclim team. If possible, could you release videos or more tutorials on using the pyleoclim package? This would greatly benefit students like me.
We have been planning on doing short "how-to" videos for a while, but we would appreciate user requests on where to start! Re: tutorials, we are updating the PyleoTutorialshttp://linked.earth/PyleoTutorials/ to be compliant with the latest code, as they were last updated last year.
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2201415212, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ7TYYRNBZL24GHFTL3ZKHRBTAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGQYTKMRRGI. You are receiving this because you were mentioned.Message ID: @.***>
Thanks - can you elaborate on where our extensive tutorials fail to properly showcase those capabilities?
First of all, I would like to thank you for the time you take to engage with me. I truly appreciate your work and after reading every day for the last 3 months your tutorials and code I understand the amount of work and time you have put into.
The tutorials don't have a problem. I am currently reading and applying your advice on my data.
I am talking from the perspective of a non-native English speaker with a basic knowledge of programming. For example, when I started using rbacon to make age-depth models I didn't know how to prepare the data in the csv file, how to change the parameters to make a better model and other things. Eventually I learned, but I would have certainly appreciated some how-to videos to guide me and make me understand what is considered a good model and output.
Again, talking from personal experience language and inexperience can sometimes cause problems, so having a video to guide you and show the basic steps you need to take is helpful. Then the user can go to the functions of your package to read and understand more.
Thank you for your time and patience, Dionysios Stamatis
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Julien Emile-Geay @.> Sent: Monday, July 1, 2024 7:04:26 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
Thanks - can you elaborate on where our extensive tutorials fail to properly showcase those capabilities?
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2201481673, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ7AOFE3G63FHNHRSSTZKHVAVAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRGQ4DCNRXGM. You are receiving this because you were mentioned.Message ID: @.***>
Thank you for the feedback! We do our best but we are a small shop, with only 4 of us actively developing the code at the moment. I implemented your requests in #595 , so that is now part of the main codebase. The updated documentation should help you figure out how to use it. For usage questions, please go to our discourse forum. Good luck and we look forward to seeing Pyleoclim used in your papers!
Dear Emile,
I apologize for the numerous emails. It seems there is a problem with some commands within the stackplot function. I updated the pyleoclim package with
pip install git+https://github.com/LinkedEarth/Pyleoclim_util.git
And then I ran the commands yticks_minor=True, xticks_minor=True, ylims='auto'
I get this response:
ypeError Traceback (most recent call last) Cell In[33], line 1 ----> 1 fig, ax = ms.stackplot(figsize=None, savefig_settings=None, time_unit=None, xlim=None, 2 fill_between_alpha=0.2, colors=None, cmap='tab10', 3 norm=None, labels='auto', ylabel_fontsize=8, 4 spine_lw=1.5, grid_lw=0.5, label_x_loc=-0.15, v_shift_factor=0.9, 5 linewidth=1.5, yticks_minor=True, xticks_minor=True, ylims='auto', 6 plot_kwargs=None)
TypeError: MultipleSeries.stackplot() got an unexpected keyword argument 'yticks_minor'
The only command that works is: yaxis_style = 'detailed' . I also used the link you sent me a week ago to update pyleoclim, but to no avail. Is there something I am missing?
Best regards, Dionysios Stamatis
From: Julien Emile-Geay @.> Sent: Wednesday, July 3, 2024 10:35 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
Thank you for the feedback! We do our best but we are a small shop, with only 4 of us actively developing the code at the moment. I implemented your requests in #595https://github.com/LinkedEarth/Pyleoclim_util/pull/595 , so that is now part of the main codebase. The updated documentationhttps://pyleoclim-util.readthedocs.io/en/latest/core/api.html#pyleoclim.core.multipleseries.MultipleSeries.stackplot should help you figure out how to use it. For usage questions, please go to our discourse forumhttps://discourse.linked.earth/c/software/7. Good luck and we look forward to seeing Pyleoclim used in your papers!
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2208061947, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ65NZLL6VBTD62NSVLZKS7JVAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGA3DCOJUG4. You are receiving this because you were mentioned.Message ID: @.***>
It does seem like your code is stuck at the previous version. Can you uninstall and re-install Pyleoclim and check the version?
I did that and it didn't work. I will try and do that again and inform you about the results.
Thank you for your time and patience, Dionysios
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Julien Emile-Geay @.> Sent: Friday, July 5, 2024 12:53:45 PM To: LinkedEarth/Pyleoclim_util @.> Cc: Stamatis, Dionysios @.>; Mention @.> Subject: [External] Re: [LinkedEarth/Pyleoclim_util] Add Minor Ticks on Y-Axis of Stackplot (Issue #576)
It does seem like your code is stuck at the previous version. Can you uninstall and re-install Pyleoclim and check the version?
— Reply to this email directly, view it on GitHubhttps://github.com/LinkedEarth/Pyleoclim_util/issues/576#issuecomment-2211219307, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD3QHZ5PBT442ZKHTCPIXUTZK3MSTAVCNFSM6AAAAABJDEQTBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRGIYTSMZQG4. You are receiving this because you were mentioned.Message ID: @.***>
Is your feature request related to a problem? Please describe. I am experiencing some frustration with the stackplot command in pyleoclim. While it is extremely useful for quickly visualizing information from different datasets, it currently lacks the ability to add minor ticks on the y-axis for each dataset. This feature would significantly enhance the clarity and detail of the final plot.
Describe the solution you'd like I have considered using the plot function along with the twinx command from matplotlib. However, this approach is limited to datasets with similar values and only works for up to four different datasets. For stackplots with five or more datasets, a more complex solution involving the subplot command might be required, which is not ideal.
Describe alternatives you've considered Perhaps the plot function can be used, with the twinx command from matlolib, but that would only work for four different datasets with similar values. For stackplots with 5 or more datasets something more complicated might work with the subplot command.
Additional context ts_final = [benthic,CO2,dD,MIS7_1_series,MIS7_series] ms_final = pyleo.MultipleSeries(ts_final)
fig, ax2 = ms_final.stackplot(figsize=[5, 10], savefig_settings=None, xlim=None, fill_between_alpha=0, colors=None, cmap='tab10', norm=None, spine_lw=1.5, grid_lw=0.5, label_x_loc=-0.15, v_shift_factor=0.75, linewidth=1.5)
Highlighting interstadial 7d and 6e
ax2=pyleo.utils.plotting.make_annotation_ax(fig, ax2, ax_name = 'highlighted_intervals', zorder=-1) intervals = [[185, 191], [225, 235]] ax2['highlighted_intervals'] = pyleo.utils.plotting.hightlight_intervals(ax2['highlighted_intervals'], intervals, color='grey', alpha=0.3)
Marking Interstadial boundaries
ax2=pyleo.utils.plotting.make_annotation_ax(fig, ax2, ax_name = 'interstadials', height=.03, loc='above', v_offset=.015,zorder=-2) ax2['interstadials'].set_facecolor((1, 1, 1, 0))
inter_intervals_pairs = [[185, 191], [191, 205], [205, 215], [215, 225], [225, 235], [235, 243]] inter_labels = ['6e', '7a', '7b', '7c', '7d', '7e'] ax2['interstadials'].set_ylim([-1,0])
colors = ['red', 'navy', 'orange', 'violet', 'green', 'aqua'] ax2['interstadials'] = pyleo.utils.plotting.hightlight_intervals(ax2['interstadials'], inter_intervals_pairs, color=colors, alpha=.2)
interstadials (labels)
ax2=pyleo.utils.plotting.make_annotation_ax(fig, ax2['interstadials'], ax_name = 'interstadial_annotation', zorder=1, v_offset=0.01, height=0, loc='above')
x_locs = [np.mean(interval) for interval in inter_intervals_pairs] ax2['interstadial_annotation'].set_ylim([0,3]) ax2['interstadial_annotation'] = pyleo.utils.plotting.label_intervals(fig, ax2['interstadial_annotation'], inter_labels, x_locs, orientation='north', baseline=.45, height=0.35, buffer=0.1, linestyle_kwargs= {'color':'gray'}, text_kwargs={'fontsize':10, 'va':'bottom'})