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

Feature Request: marker Parameter in function from_matplotlib() #134

Closed
luator opened this issue Sep 29, 2022 · 7 comments
Closed

Feature Request: marker Parameter in function from_matplotlib() #134

luator opened this issue Sep 29, 2022 · 7 comments

Comments

@luator
Copy link
Contributor

luator commented Sep 29, 2022

Is there a way to specify the marker type when using from_matplotlib()?

I browsed a bit through the code and it seems it would be straight forward to add an marker argument to the function but I was wondering if there is already some other way to achieve this (e.g. by changing the global default)?

@piccolomo
Copy link
Owner

Thanks, I will look this up! If you find anything else (any other parameter etc.) about that function please let me know, :-)

Thanks

@luator
Copy link
Contributor Author

luator commented Sep 29, 2022

I found that I can overwrite the default like this:

plotext._utility.plot_marker = "braille"

While this works, it doesn't feel right as it is accessing a private module.
Would it make sense to add a function set_marker for doing this in a more proper way? This would allow to change the marker used in from_matplotlib() but in addition might also be useful in other situations.

I can make a PR adding such a function if you agree.

@piccolomo
Copy link
Owner

piccolomo commented Sep 29, 2022

Hi I think tinkering with default values is overkilling it. Possibly a marker parameter in the from_matplotlib() function could be an idea. The problem is that it would be the same for each subplot if present. I have to look it up exactly but perhaps one could add a function to change a subplot marker which could be accessed with something like plt.figure.subplot().monitor.marker (may not be exactly right). Perhaps a function for that?

@piccolomo
Copy link
Owner

Btw you made me aware that probably I should transfer that default value to _default.py in the default_monitor class. From there if you still think it could be an idea, one could add a function like change_default(marker.... or anyother). The default value could be accessed with figure.subplot(row, col).monitor.default.marker.

@piccolomo
Copy link
Owner

piccolomo commented Sep 29, 2022

Note: changing the dafault value, will apply it to all subplots. If you need to change each subplot marker a command that addresses plt.figure.subplot(row, col).monitor.marker is what you want.

@piccolomo
Copy link
Owner

Hi @luator,

I added the marker parameter to the from_matplotlib() function. It worked on my system, but if issue persists please keep updated. It would be great if you could double test it. It does not allow to change the marker for a specific subplot tough.

The new GitHub version 5.2.8 could be installed using: pip install git+https://github.com/piccolomo/plotext.

Thanks a lot for the issue report, and any other bug report is very welcomed.

All the best,
Savino

@piccolomo piccolomo changed the title Option to change marker type in from_matplotlib() Feature Request: marker Parameter in function from_matplotlib() Oct 6, 2022
@luator
Copy link
Contributor Author

luator commented Oct 7, 2022

Thanks for taking care of this so fast! I did a quick test and it looks good to me. I think it is completely sufficient to have one marker style for all subplots in this function.

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

2 participants