Comments (8)
What about an sns.get_current_axes_style()
function? There may be certain subplots that could be one style, and others another style. Or is this a more "Pythonic" route with with
? I've only ever use with
for opening files.
from seaborn.
Yes, I think using a context manager is a lot cleaner.
What this avoids is any kind of global variable naming the seaborn style. All the __enter__
method will do is copy the current rcParams
and set them to something else, then the __exit__
method will just set the original rcParams
back to what they were at the start of the block. This will respect any changes to the rcParams
that have been made independently of seaborn.
Because of the way matplotlib works, (I think) only the code that creates the axis object needs to be inside the style context; after that, the axis knows about all the parameters that are going to control how it looks.
from seaborn.
Also I think it's preferable to have themes defined by a dictionary of rc parameters, with the names (nogrid, darkgrid, etc.) serving as aliases for those parameters.
from seaborn.
I think axes_style should also take keyword arguments that override any
rc values it's messing with/complement the changes.
How would you feel about similar functionality in sns.set(...)
?
from seaborn.
How would you feel about similar functionality in sns.set(...)?
Ambivalent. set()
feels like it's a little overloaded currently, but I'm going to reevaluate once I straighten out the set_*
functions to work more cleanly.
Also it's since occurred to me that because of how the mpl parameters are named (i.e. the presence of periods) you can pass them as kwargs. So this will end up having to be a single argument taking a dict, I think.
from seaborn.
I see. Just to be clear, we're both talking about something a simple as this, right?
def set(context="notebook", style="darkgrid", palette="deep", font="Arial",
gridweight=None, customparams={}):
"""Set new RC params in one step."""
set_axes_style(style, context, font=font, gridweight=gridweight)
set_color_palette(palette)
mpl.rcParams.update(customparams)
Which will enable something like this: http://nbviewer.ipython.org/gist/phobson/9394948
from seaborn.
What is this, base R graphics? :)
Yeah, I don't have a big problem with that, I just want to leave set
alone until the underlying set_*
functions have a clear definition. One thing that is confusing about matplotlib is that there are like 15 different ways to set rc parameters, which is very un-pythonic. I am not sure I want to add 4 different ways (or whatever) of doing it in seaborn too. But, once the dust clears, this approach will probably seem reasonable.
from seaborn.
With you 100% on that. Just wanted to make sure we were on the same page :)
from seaborn.
Related Issues (20)
- clustermap appears to cast arrays to numpy dtype float64 by default HOT 2
- Update seaborn.categorical.py to allow adjusting the marker colors of the box plot within a violin plots
- DOC: seaborn.set_context should note that it sets the global defaults for all plots using the matplotlib rcParams system HOT 6
- scatterplot crashes or produces unexpected results when {`hue`,`style`}`_order` do not contain all `hue`/`style` values HOT 3
- seaborn HOT 2
- 0.13.1: test suite needs `husl` module HOT 1
- seaborn issue HOT 2
- Parameter fix in violinplot documentation HOT 1
- linecolor for boxplot HOT 1
- load_dataset cannot find example datasets HOT 4
- seaborn.objects incorrectly plots secondary y-axis HOT 1
- In Seaborn version 0.13, how to set the legend background to transparent and the legend title to empty? HOT 4
- seaborn scatterplot hue= datetime bug HOT 3
- Resolve pandas 2.2 warnings HOT 4
- location and orientation of split violins HOT 4
- Warning with pandas 2.2.0 and seaborn 0.13.1 kdeplot HOT 2
- sns.histplot does not draw correct bins when using log for y-axis. HOT 3
- Performance Issue: Seaborn Lineplot Execution Time Discrepancy with and without Timezones HOT 5
- sns.barplot(index ="index", x=" data_column1", y="data_column2") creates error due to whitespace before column name in x, y parameters HOT 1
- AttributeError: module 'numpy' has no attribute 'float'. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seaborn.