├── .gitignore
├── LICENSE
├── MANIFEST.in
├── README.md
├── examples.ipynb
├── examples_files
├── examples_10_0.png
├── examples_11_0.png
├── examples_11_1.png
├── examples_14_1.png
├── examples_16_0.png
├── examples_16_1.png
├── examples_17_0.png
├── examples_17_1.png
├── examples_18_0.png
├── examples_19_0.png
├── examples_19_1.png
├── examples_20_0.png
├── examples_21_0.png
├── examples_21_1.png
├── examples_22_0.png
├── examples_23_0.png
├── examples_23_1.png
├── examples_24_0.png
├── examples_24_1.png
├── examples_25_0.png
├── examples_25_1.png
├── examples_25_2.png
├── examples_26_0.png
├── examples_26_1.png
├── examples_27_0.png
├── examples_28_0.png
├── examples_29_0.png
├── examples_29_1.png
├── examples_30_0.png
├── examples_30_1.png
├── examples_32_0.png
├── examples_32_1.png
├── examples_33_0.png
├── examples_33_1.png
├── examples_35_0.png
├── examples_37_0.png
├── examples_39_0.png
├── examples_39_1.png
├── examples_41_0.png
├── examples_43_0.png
├── examples_45_0.png
├── examples_47_0.png
├── examples_48_0.png
├── examples_49_0.png
├── examples_4_0.png
├── examples_4_1.png
├── examples_50_0.png
├── examples_51_0.png
├── examples_52_0.png
├── examples_53_0.png
├── examples_54_0.png
├── examples_54_1.png
├── examples_55_0.png
├── examples_55_1.png
├── examples_57_0.png
├── examples_57_1.png
├── examples_57_2.png
├── examples_58_0.png
├── examples_58_1.png
├── examples_58_2.png
├── examples_60_0.png
├── examples_60_1.png
├── examples_61_0.png
├── examples_61_1.png
├── examples_62_0.png
├── examples_62_1.png
├── examples_63_0.png
├── examples_63_1.png
├── examples_64_0.png
├── examples_64_1.png
├── examples_69_1.png
└── examples_70_1.png
├── issue_template.md
├── pull_request_template.md
├── pyplot_themes
├── __init__.py
├── __version__.py
├── palettes.py
├── rcmod.py
└── themes.py
└── setup.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
106 | # vscode
107 | .vscode/
108 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 raybuhr
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.md LICENSE
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # pyplot-themes
3 | Themes you can see that apply to matplotlib, seaborn, and pandas plots.
4 |
5 | This package was inspired by the [`ggthemes` package in R](https://jrnold.github.io/ggthemes/),
6 | and the code influenced from the [`seaborn` package in python](https://seaborn.pydata.org/) (specifically `rcmod.py`).
7 |
8 | ## Installing
9 |
10 | Install from PyPI
11 |
12 | ```
13 | pip install pyplot-themes
14 | ```
15 |
16 | Or directly from GitHub
17 |
18 | ```
19 | pip install git+https://github.com/raybuhr/pyplot-themes.git
20 | ```
21 |
22 | ## Usage
23 |
24 | ### Environment
25 |
26 |
27 | ```python
28 | import sys
29 | sys.version
30 | ```
31 |
32 |
33 |
34 |
35 | '3.7.1 (default, Dec 14 2018, 19:28:38) \n[GCC 7.3.0]'
36 |
37 |
38 |
39 |
40 | ```python
41 | import matplotlib.pyplot as plt
42 | from seaborn import palplot # only used to show off palettes
43 |
44 | from string import ascii_uppercase
45 | import numpy as np
46 |
47 |
48 | def example_scatter_plot(num_cats=6):
49 | for i in range(num_cats):
50 | cat = ascii_uppercase[i]
51 | x = np.random.random(100)
52 | y = np.random.random(100) + i
53 | plt.scatter(x, y, marker='o', label=cat)
54 | plt.legend(loc='best')
55 |
56 |
57 | def example_bar_plot(num_cats=6):
58 | bar_width = 1 / num_cats + 1
59 | for i in range(num_cats):
60 | cat = ascii_uppercase[i]
61 | x = np.arange(11) + 5 * i
62 | y = np.array([0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]) + np.random.random(1)
63 | plt.bar(x, y, label=cat, width=bar_width)
64 | plt.legend(loc='best')
65 |
66 |
67 | def example_plots(num_cats=6):
68 | example_scatter_plot(num_cats)
69 | plt.show()
70 | example_bar_plot(num_cats)
71 | plt.show()
72 | ```
73 |
74 | ## Default Matplotlib Theme
75 |
76 |
77 | ```python
78 | example_plots()
79 | ```
80 |
81 |
82 | 
83 |
84 |
85 |
86 | 
87 |
88 |
89 | As you can see, the default theme has good contrast in colors, but leaves a bit to be desired in the sige of the chart (i.e. figure size aka figsize) and font.
90 |
91 | ## Usage
92 |
93 |
94 | ```python
95 | import pyplot_themes as themes
96 | themes.__version__
97 | ```
98 |
99 |
100 |
101 |
102 | '0.2.2'
103 |
104 |
105 |
106 |
107 | ```python
108 | themes.theme_minimal()
109 | ```
110 |
111 | This updates the global theme settings for matplotlib with a nice minimal style using colorblind safe colors.
112 |
113 |
114 | ```python
115 | palplot(themes.palettes.Colorblind.colors)
116 | ```
117 |
118 |
119 | 
120 |
121 |
122 |
123 | ```python
124 | example_plots()
125 | ```
126 |
127 |
128 | 
129 |
130 |
131 |
132 | 
133 |
134 |
135 | As you can see, our plots are much larger now, have accessible colors, and have some light gridlines to make identifying values a bit easier.
136 |
137 | There are a few parameters available in all themes:
138 | - grid: toggles grid lines on/off
139 | - ticks: toggles tick marks on/off
140 | - figsize: sets the default size of plots (you can still change each plot in an ad hoc manner if needed)
141 | - fontsize: sets the default font size to be used
142 |
143 | Some themes will allow you to pass in whatever colors you want, others you have to pick a color scheme from available options, some only let you reverse the order of the default color palette, and some don't let you mess with the colors at all. Experiment and find out what you like.
144 |
145 |
146 | ```python
147 | themes.theme_minimal(grid=False, ticks=False, fontsize=18)
148 | example_scatter_plot()
149 | plt.title("Look Mom, no lines!")
150 | ```
151 |
152 |
153 |
154 |
155 | Text(0.5, 1.0, 'Look Mom, no lines!')
156 |
157 |
158 |
159 |
160 | 
161 |
162 |
163 | ### Themes
164 |
165 |
166 | ```python
167 | themes.theme_dark()
168 | example_plots()
169 | ```
170 |
171 |
172 | 
173 |
174 |
175 |
176 | 
177 |
178 |
179 |
180 | ```python
181 | themes.theme_tableau()
182 | example_plots()
183 | ```
184 |
185 |
186 | 
187 |
188 |
189 |
190 | 
191 |
192 |
193 |
194 | ```python
195 | palplot(themes.palettes.Solarized.dark)
196 | ```
197 |
198 |
199 | 
200 |
201 |
202 |
203 | ```python
204 | themes.theme_solarized(scheme="dark")
205 | example_plots()
206 | ```
207 |
208 |
209 | 
210 |
211 |
212 |
213 | 
214 |
215 |
216 |
217 | ```python
218 | palplot(themes.palettes.Solarized.light)
219 | ```
220 |
221 |
222 | 
223 |
224 |
225 |
226 | ```python
227 | themes.theme_solarized(scheme="light")
228 | example_plots()
229 | ```
230 |
231 |
232 | 
233 |
234 |
235 |
236 | 
237 |
238 |
239 |
240 | ```python
241 | palplot(themes.palettes.PaulTolColorSchemes.colors)
242 | ```
243 |
244 |
245 | 
246 |
247 |
248 |
249 | ```python
250 | themes.theme_paul_tol()
251 | example_plots(12)
252 | ```
253 |
254 |
255 | 
256 |
257 |
258 |
259 | 
260 |
261 |
262 |
263 | ```python
264 | themes.theme_paul_tol(reverse_colors=True, grid=False)
265 | example_plots(num_cats=12)
266 | ```
267 |
268 |
269 | 
270 |
271 |
272 |
273 | 
274 |
275 |
276 |
277 | ```python
278 | palplot(themes.palettes.Few.light)
279 | palplot(themes.palettes.Few.medium)
280 | palplot(themes.palettes.Few.dark)
281 | ```
282 |
283 |
284 | 
285 |
286 |
287 |
288 | 
289 |
290 |
291 |
292 | 
293 |
294 |
295 |
296 | ```python
297 | themes.theme_few(scheme="light")
298 | example_plots()
299 | ```
300 |
301 |
302 | 
303 |
304 |
305 |
306 | 
307 |
308 |
309 |
310 | ```python
311 | themes.theme_few(scheme="medium", figsize=[5, 5])
312 | example_scatter_plot()
313 | ```
314 |
315 |
316 | 
317 |
318 |
319 |
320 | ```python
321 | themes.theme_few(scheme="dark")
322 | example_bar_plot()
323 | ```
324 |
325 |
326 | 
327 |
328 |
329 |
330 | ```python
331 | themes.theme_ucberkeley(figsize=[10, 5])
332 | example_plots(num_cats=4)
333 | ```
334 |
335 |
336 | 
337 |
338 |
339 |
340 | 
341 |
342 |
343 |
344 | ```python
345 | themes.theme_ucberkeley(scheme="all", figsize=[12, 6])
346 | example_plots(num_cats=16)
347 | ```
348 |
349 |
350 | 
351 |
352 |
353 |
354 | 
355 |
356 |
357 | ### Themes that come with matplotlib
358 |
359 | These next themes actually come with matplotlib and you can use them without the `pyplot-themes` package.
360 | The functions here are basically thin wrappers for calling the matplotlib defined styles, but use a bigger figsize by default.
361 |
362 |
363 | ```python
364 | themes.theme_fivethirtyeight()
365 | example_plots()
366 | ```
367 |
368 |
369 | 
370 |
371 |
372 |
373 | 
374 |
375 |
376 |
377 | ```python
378 | themes.theme_ggplot2(figsize=[10, 5])
379 | example_plots()
380 | ```
381 |
382 |
383 | 
384 |
385 |
386 |
387 | 
388 |
389 |
390 | `bmh` stands for Bayesian Methods for Hackers
391 |
392 |
393 | ```python
394 | themes.theme_bmh()
395 | example_scatter_plot()
396 | ```
397 |
398 |
399 | 
400 |
401 |
402 | So we also have an alias for the spelled out version to make it easier to discover
403 |
404 |
405 | ```python
406 | themes.theme_bayesian_methods_for_hackers()
407 | example_bar_plot()
408 | ```
409 |
410 |
411 | 
412 |
413 |
414 | While this package provides light and dark solarized themes, `matplotlib` comes with a light version as well. This one is a good choice if you want to keep more contrast in the colors of your plots.
415 |
416 |
417 | ```python
418 | themes.theme_solarized_light2()
419 | example_plots()
420 | ```
421 |
422 |
423 | 
424 |
425 |
426 |
427 | 
428 |
429 |
430 | ### Modifying Themes
431 |
432 | In addition to making it easy to find and call the matplotlib themes, `pyplot-themes` also makes it easier to modify them slightly. For example say you want to use the `ggplot2` theme, but you want to use the Paul Tol Color Schemes palette with it.
433 |
434 |
435 | ```python
436 | themes.theme_ggplot2(palette=themes.palettes.PaulTolColorSchemes.colors, figsize=[12, 6])
437 | example_bar_plot(num_cats=12)
438 | ```
439 |
440 |
441 | 
442 |
443 |
444 | Or maybe the `fivethirtyeight` colors
445 |
446 |
447 | ```python
448 | themes.theme_ggplot2(palette=themes.palettes.FiveThirtyEight.colors)
449 | example_bar_plot()
450 | ```
451 |
452 |
453 | 
454 |
455 |
456 | ### Resetting to back to matplotlib defaults
457 |
458 | Of course, sometimes when you are trying out different themes, you may find you modified a setting that you didn't quite like, but aren't sure what changed. To aid in debugging, we created a function to reset the theme back to what matplotlib starts with. Of course, you may just like the matplotlib defaults and that's ok.
459 |
460 | Note: The default settings for matplotlib can be slightly different depending on if you are using in python files (e.g. scripts) vs. in jupyter notebooks using `%matplotlib inline`. The reset function assumes you are using a notebook by default, but provides a parameter to toggle that off if you are not:
461 |
462 | ```python
463 | themes.theme_reset(notebook=False)
464 | ```
465 |
466 |
467 | ```python
468 | themes.theme_reset() # could also use the alias `themes.theme_matplotlib_default()`
469 | example_bar_plot()
470 | ```
471 |
472 |
473 | 
474 |
475 |
476 | ### Palettes
477 |
478 | In addition to the themes above, there are a bunch of color palettes provided. Here are a few to show off.
479 |
480 |
481 | ```python
482 | palplot(themes.palettes.Autumn1.colors)
483 | ```
484 |
485 |
486 | 
487 |
488 |
489 |
490 | ```python
491 | palplot(themes.palettes.Autumn2.colors)
492 | ```
493 |
494 |
495 | 
496 |
497 |
498 |
499 | ```python
500 | palplot(themes.palettes.Canyon.colors)
501 | ```
502 |
503 |
504 | 
505 |
506 |
507 |
508 | ```python
509 | palplot(themes.palettes.Chili.colors)
510 | ```
511 |
512 |
513 | 
514 |
515 |
516 |
517 | ```python
518 | palplot(themes.palettes.Tomato.colors)
519 | ```
520 |
521 |
522 | 
523 |
524 |
525 |
526 | ```python
527 | palplot(themes.palettes.Few.medium)
528 | ```
529 |
530 |
531 | 
532 |
533 |
534 |
535 | ```python
536 | palplot(themes.palettes.FiveThirtyEight.colors)
537 | ```
538 |
539 |
540 | 
541 |
542 |
543 |
544 | ```python
545 | palplot(themes.palettes.Solarized.light)
546 | palplot(themes.palettes.Solarized.dark)
547 | ```
548 |
549 |
550 | 
551 |
552 |
553 |
554 | 
555 |
556 |
557 |
558 | ```python
559 | palplot(themes.palettes.UCBerkeley.primary_colors)
560 | palplot(themes.palettes.UCBerkeley.secondary_colors)
561 | ```
562 |
563 |
564 | 
565 |
566 |
567 |
568 | 
569 |
570 |
571 | ### Sequential Palettes
572 |
573 |
574 | ```python
575 | palplot(themes.palettes.Sequential.blues)
576 | palplot(themes.palettes.Sequential.cyans)
577 | palplot(themes.palettes.Sequential.purples)
578 | ```
579 |
580 |
581 | 
582 |
583 |
584 |
585 | 
586 |
587 |
588 |
589 | 
590 |
591 |
592 |
593 | ```python
594 | palplot(themes.palettes.Sequential.greens)
595 | palplot(themes.palettes.Sequential.oranges)
596 | palplot(themes.palettes.Sequential.reds)
597 | ```
598 |
599 |
600 | 
601 |
602 |
603 |
604 | 
605 |
606 |
607 |
608 | 
609 |
610 |
611 | ### Diverging Palettes
612 |
613 |
614 | ```python
615 | palplot(themes.palettes.Diverging.blueorange)
616 | palplot(themes.palettes.Diverging.orangeblue)
617 | ```
618 |
619 |
620 | 
621 |
622 |
623 |
624 | 
625 |
626 |
627 |
628 | ```python
629 | palplot(themes.palettes.Diverging.bluepurple)
630 | palplot(themes.palettes.Diverging.purpleblue)
631 | ```
632 |
633 |
634 | 
635 |
636 |
637 |
638 | 
639 |
640 |
641 |
642 | ```python
643 | palplot(themes.palettes.Diverging.bluered)
644 | palplot(themes.palettes.Diverging.redblue)
645 | ```
646 |
647 |
648 | 
649 |
650 |
651 |
652 | 
653 |
654 |
655 |
656 | ```python
657 | palplot(themes.palettes.Diverging.greenpurple)
658 | palplot(themes.palettes.Diverging.purplegreen)
659 | ```
660 |
661 |
662 | 
663 |
664 |
665 |
666 | 
667 |
668 |
669 |
670 | ```python
671 | palplot(themes.palettes.Diverging.greenred)
672 | palplot(themes.palettes.Diverging.redgreen)
673 | ```
674 |
675 |
676 | 
677 |
678 |
679 |
680 | 
681 |
682 |
683 | ### Using with Pandas
684 |
685 |
686 | ```python
687 | import pandas as pd
688 | ```
689 |
690 |
691 | ```python
692 | # some made up date
693 | sales = np.random.randint(low=10, high=20, size=30) * [i**2 for i in range(1, 31)]
694 | revenue = np.random.random(30) * sales
695 | months = pd.date_range(start="2010-01-01", periods=30, freq="M")
696 |
697 | df = pd.DataFrame({"sales": sales, "revenue": revenue.round(2)}, index=months)
698 | ```
699 |
700 |
701 | ```python
702 | df.head()
703 | ```
704 |
705 |
706 |
707 |
708 |
709 |
722 |
723 |
724 |
725 | |
726 | sales |
727 | revenue |
728 |
729 |
730 |
731 |
732 | 2010-01-31 |
733 | 12 |
734 | 2.76 |
735 |
736 |
737 | 2010-02-28 |
738 | 52 |
739 | 45.05 |
740 |
741 |
742 | 2010-03-31 |
743 | 90 |
744 | 11.80 |
745 |
746 |
747 | 2010-04-30 |
748 | 208 |
749 | 203.93 |
750 |
751 |
752 | 2010-05-31 |
753 | 475 |
754 | 337.08 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 | ```python
764 | themes.theme_minimal()
765 | df.plot()
766 | ```
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 | 
777 |
778 |
779 |
780 | ```python
781 | themes.theme_dark(palette=themes.palettes.Autumn1.colors)
782 | df.plot()
783 | ```
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 | 
794 |
795 |
796 | ## Contributing
797 |
798 | There are multiple ways you can help out with this project:
799 |
800 | - submit a bug report
801 | - submit a feature request
802 | - Fork this git repo, change some code, and submit a Pull Request
803 | - adding documentation or examples counts as changing code
804 |
--------------------------------------------------------------------------------
/examples_files/examples_10_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_10_0.png
--------------------------------------------------------------------------------
/examples_files/examples_11_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_11_0.png
--------------------------------------------------------------------------------
/examples_files/examples_11_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_11_1.png
--------------------------------------------------------------------------------
/examples_files/examples_14_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_14_1.png
--------------------------------------------------------------------------------
/examples_files/examples_16_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_16_0.png
--------------------------------------------------------------------------------
/examples_files/examples_16_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_16_1.png
--------------------------------------------------------------------------------
/examples_files/examples_17_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_17_0.png
--------------------------------------------------------------------------------
/examples_files/examples_17_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_17_1.png
--------------------------------------------------------------------------------
/examples_files/examples_18_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_18_0.png
--------------------------------------------------------------------------------
/examples_files/examples_19_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_19_0.png
--------------------------------------------------------------------------------
/examples_files/examples_19_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_19_1.png
--------------------------------------------------------------------------------
/examples_files/examples_20_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_20_0.png
--------------------------------------------------------------------------------
/examples_files/examples_21_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_21_0.png
--------------------------------------------------------------------------------
/examples_files/examples_21_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_21_1.png
--------------------------------------------------------------------------------
/examples_files/examples_22_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_22_0.png
--------------------------------------------------------------------------------
/examples_files/examples_23_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_23_0.png
--------------------------------------------------------------------------------
/examples_files/examples_23_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_23_1.png
--------------------------------------------------------------------------------
/examples_files/examples_24_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_24_0.png
--------------------------------------------------------------------------------
/examples_files/examples_24_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_24_1.png
--------------------------------------------------------------------------------
/examples_files/examples_25_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_25_0.png
--------------------------------------------------------------------------------
/examples_files/examples_25_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_25_1.png
--------------------------------------------------------------------------------
/examples_files/examples_25_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_25_2.png
--------------------------------------------------------------------------------
/examples_files/examples_26_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_26_0.png
--------------------------------------------------------------------------------
/examples_files/examples_26_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_26_1.png
--------------------------------------------------------------------------------
/examples_files/examples_27_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_27_0.png
--------------------------------------------------------------------------------
/examples_files/examples_28_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_28_0.png
--------------------------------------------------------------------------------
/examples_files/examples_29_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_29_0.png
--------------------------------------------------------------------------------
/examples_files/examples_29_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_29_1.png
--------------------------------------------------------------------------------
/examples_files/examples_30_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_30_0.png
--------------------------------------------------------------------------------
/examples_files/examples_30_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_30_1.png
--------------------------------------------------------------------------------
/examples_files/examples_32_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_32_0.png
--------------------------------------------------------------------------------
/examples_files/examples_32_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_32_1.png
--------------------------------------------------------------------------------
/examples_files/examples_33_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_33_0.png
--------------------------------------------------------------------------------
/examples_files/examples_33_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_33_1.png
--------------------------------------------------------------------------------
/examples_files/examples_35_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_35_0.png
--------------------------------------------------------------------------------
/examples_files/examples_37_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_37_0.png
--------------------------------------------------------------------------------
/examples_files/examples_39_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_39_0.png
--------------------------------------------------------------------------------
/examples_files/examples_39_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_39_1.png
--------------------------------------------------------------------------------
/examples_files/examples_41_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_41_0.png
--------------------------------------------------------------------------------
/examples_files/examples_43_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_43_0.png
--------------------------------------------------------------------------------
/examples_files/examples_45_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_45_0.png
--------------------------------------------------------------------------------
/examples_files/examples_47_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_47_0.png
--------------------------------------------------------------------------------
/examples_files/examples_48_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_48_0.png
--------------------------------------------------------------------------------
/examples_files/examples_49_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_49_0.png
--------------------------------------------------------------------------------
/examples_files/examples_4_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_4_0.png
--------------------------------------------------------------------------------
/examples_files/examples_4_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_4_1.png
--------------------------------------------------------------------------------
/examples_files/examples_50_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_50_0.png
--------------------------------------------------------------------------------
/examples_files/examples_51_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_51_0.png
--------------------------------------------------------------------------------
/examples_files/examples_52_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_52_0.png
--------------------------------------------------------------------------------
/examples_files/examples_53_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_53_0.png
--------------------------------------------------------------------------------
/examples_files/examples_54_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_54_0.png
--------------------------------------------------------------------------------
/examples_files/examples_54_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_54_1.png
--------------------------------------------------------------------------------
/examples_files/examples_55_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_55_0.png
--------------------------------------------------------------------------------
/examples_files/examples_55_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_55_1.png
--------------------------------------------------------------------------------
/examples_files/examples_57_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_57_0.png
--------------------------------------------------------------------------------
/examples_files/examples_57_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_57_1.png
--------------------------------------------------------------------------------
/examples_files/examples_57_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_57_2.png
--------------------------------------------------------------------------------
/examples_files/examples_58_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_58_0.png
--------------------------------------------------------------------------------
/examples_files/examples_58_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_58_1.png
--------------------------------------------------------------------------------
/examples_files/examples_58_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_58_2.png
--------------------------------------------------------------------------------
/examples_files/examples_60_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_60_0.png
--------------------------------------------------------------------------------
/examples_files/examples_60_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_60_1.png
--------------------------------------------------------------------------------
/examples_files/examples_61_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_61_0.png
--------------------------------------------------------------------------------
/examples_files/examples_61_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_61_1.png
--------------------------------------------------------------------------------
/examples_files/examples_62_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_62_0.png
--------------------------------------------------------------------------------
/examples_files/examples_62_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_62_1.png
--------------------------------------------------------------------------------
/examples_files/examples_63_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_63_0.png
--------------------------------------------------------------------------------
/examples_files/examples_63_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_63_1.png
--------------------------------------------------------------------------------
/examples_files/examples_64_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_64_0.png
--------------------------------------------------------------------------------
/examples_files/examples_64_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_64_1.png
--------------------------------------------------------------------------------
/examples_files/examples_69_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_69_1.png
--------------------------------------------------------------------------------
/examples_files/examples_70_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raybuhr/pyplot-themes/9d8981382a076a85d85236055775ef406b83d96b/examples_files/examples_70_1.png
--------------------------------------------------------------------------------
/issue_template.md:
--------------------------------------------------------------------------------
1 | ### Issue and Steps to Reproduce
2 |
3 |
4 | ### Versions
5 |
6 | ### Screenshots
7 |
8 | #### Expected
9 |
10 | #### Actual
11 |
12 | ### Additional Details
13 | * Installed packages:
14 |
--------------------------------------------------------------------------------
/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ### All Submissions:
2 |
3 | * [ ] Have you followed the guidelines in our Contributing document?
4 | * [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?
5 |
6 |
7 |
8 | ### New Feature Submissions:
9 |
10 | 1. [ ] Does your submission pass tests?
11 | 2. [ ] Have you lint your code locally prior to submission?
12 |
13 | ### Changes to Core Features:
14 |
15 | * [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
16 | * [ ] Have you written new tests for your core changes, as applicable?
17 | * [ ] Have you successfully ran tests with your changes locally?
18 |
19 | ### Screenshots
20 |
--------------------------------------------------------------------------------
/pyplot_themes/__init__.py:
--------------------------------------------------------------------------------
1 | from .themes import (
2 | create_palette,
3 | list_available_colors,
4 | theme_bayesian_methods_for_hackers,
5 | theme_bmh,
6 | theme_dark,
7 | theme_few,
8 | theme_fivethirtyeight,
9 | theme_ggplot2,
10 | theme_matplotlib_default,
11 | theme_minimal,
12 | theme_paul_tol,
13 | theme_reset,
14 | theme_solarized_light2,
15 | theme_solarized,
16 | theme_tableau,
17 | theme_ucberkeley,
18 | )
19 | from .__version__ import __version__
20 |
--------------------------------------------------------------------------------
/pyplot_themes/__version__.py:
--------------------------------------------------------------------------------
1 | VERSION = (0, 2, 2)
2 |
3 | __version__ = '.'.join(map(str, VERSION))
4 |
--------------------------------------------------------------------------------
/pyplot_themes/palettes.py:
--------------------------------------------------------------------------------
1 | class Colorblind:
2 | info = {
3 | "Black": "#000000",
4 | "Orange": "#E69F00",
5 | "Sky Blue": "#56B4E9",
6 | "Bluish Green": "#009E73",
7 | "Yellow": "#F0E442",
8 | "Blue": "#0072B2",
9 | "Vermillion": "#D55E00",
10 | "Reddish Purple": "#CC79A7",
11 | }
12 | colors = list(info.values())
13 |
14 |
15 | class Solarized:
16 | dark = [
17 | "#002b36",
18 | "#073642",
19 | "#586e75",
20 | "#657b83",
21 | "#839496",
22 | "#93a1a1",
23 | "#eee8d5",
24 | "#fdf6e3",
25 | ]
26 | light = dark[::-1]
27 |
28 |
29 | class PaulTolColorSchemes:
30 | colors = [
31 | "#332288",
32 | "#6699CC",
33 | "#88CCEE",
34 | "#44AA99",
35 | "#117733",
36 | "#999933",
37 | "#DDCC77",
38 | "#661100",
39 | "#CC6677",
40 | "#AA4466",
41 | "#882255",
42 | "#AA4499",
43 | ]
44 |
45 |
46 | class Few:
47 | light = [
48 | "#8C8C8C",
49 | "#88BDE6",
50 | "#FBB258",
51 | "#90CD97",
52 | "#F6AAC9",
53 | "#BFA554",
54 | "#BC99C7",
55 | "#EDDD46",
56 | "#F07E6E",
57 | ]
58 | medium = [
59 | "#4D4D4D",
60 | "#5DA5DA",
61 | "#FAA43A",
62 | "#60BD68",
63 | "#F17CB0",
64 | "#B2912F",
65 | "#B276B2",
66 | "#DECF3F",
67 | "#F15854",
68 | ]
69 | dark = [
70 | "#000000",
71 | "#265DAB",
72 | "#DF5C24",
73 | "#059748",
74 | "#E5126F",
75 | "#9D722A",
76 | "#7B3A96",
77 | "#C7B42E",
78 | "#CB2027",
79 | ]
80 |
81 |
82 | class FiveThirtyEight:
83 | colors = ["#008fd5", "#fc4f30", "#e5ae38", "#6d904f", "#8b8b8b", "#810f7c"]
84 |
85 |
86 | class UCBerkeley:
87 | """From https://brand.berkeley.edu/colors/"""
88 |
89 | info = [
90 | {"hex_value": "#003262", "name": "Berkeley blue", "type": "primary"},
91 | {"hex_value": "#3B7EA1", "name": "Founder’s Rock", "type": "primary"},
92 | {"hex_value": "#FDB515", "name": "California Gold", "type": "primary"},
93 | {"hex_value": "#C4820E", "name": "Medalist", "type": "primary"},
94 | {"hex_value": "#D9661F", "name": "Wellman Tile", "type": "secondary"},
95 | {"hex_value": "#EE1F60", "name": "Rose Garden", "type": "secondary"},
96 | {"hex_value": "#ED4E33", "name": "Golden Gate", "type": "secondary"},
97 | {"hex_value": "#6C3302", "name": "South Hall", "type": "secondary"},
98 | {"hex_value": "#DDD5C7", "name": "Bay Fog", "type": "secondary"},
99 | {"hex_value": "#00B0DA", "name": "Lawrence", "type": "secondary"},
100 | {"hex_value": "#00A598", "name": "Lap Lane", "type": "secondary"},
101 | {"hex_value": "#46535E", "name": "Pacific", "type": "secondary"},
102 | {"hex_value": "#B9D3B6", "name": "Sather Gate", "type": "secondary"},
103 | {"hex_value": "#CFDD45", "name": "Ion", "type": "secondary"},
104 | {"hex_value": "#859438", "name": "Soybean", "type": "secondary"},
105 | {"hex_value": "#584F29", "name": "Stone Pine", "type": "secondary"},
106 | ]
107 | colors = [d["hex_value"] for d in info]
108 | primary_colors = [d["hex_value"] for d in info if d["type"] == "primary"]
109 | secondary_colors = [d["hex_value"] for d in info if d["type"] == "secondary"]
110 |
111 |
112 | class Autumn1:
113 | """From https://duoparadigms.com/2013/10/11/10-color-palettes-perfect-autumnfall-season/"""
114 |
115 | colors = ["#D1CEC5", "#997C67", "#755330", "#B0703C", "#DBA72E", "#E3CCA1"]
116 |
117 |
118 | class Autumn2:
119 | """From https://duoparadigms.com/2013/10/11/10-color-palettes-perfect-autumnfall-season/"""
120 |
121 | colors = ["#6D7696", "#59484F", "#455C4F", "#CC5543", "#EDB579", "#DBE6AF"]
122 |
123 |
124 | class Canyon:
125 | """From https://duoparadigms.com/2013/10/11/10-color-palettes-perfect-autumnfall-season/"""
126 |
127 | colors = ["#6E352C", "#CF5230", "#F59A44", "#E3C598", "#8A6E64", "#6E612F"]
128 |
129 |
130 | class Chili:
131 | """From https://duoparadigms.com/2013/10/11/10-color-palettes-perfect-autumnfall-season/"""
132 |
133 | colors = ["#283811", "#66492F", "#B8997F", "#A68887", "#D94330", "#5C0811"]
134 |
135 |
136 | class Tomato:
137 | """From https://duoparadigms.com/2013/10/11/10-color-palettes-perfect-autumnfall-season/"""
138 |
139 | colors = ["#D6CFC9", "#C2C290", "#4A572C", "#803018", "#E34819", "#E87F60"]
140 |
141 |
142 | class Sequential:
143 | """Color gradients based on a single base color"""
144 | blues = [
145 | "#00008b",
146 | "#302197",
147 | "#483ba2",
148 | "#5d54ae",
149 | "#6f6db9",
150 | "#7f87c5",
151 | "#8fa1d0",
152 | "#9ebcdb",
153 | "#add8e6",
154 | ]
155 |
156 | cyans = [
157 | "#002728",
158 | "#003d43",
159 | "#00565a",
160 | "#007073",
161 | "#008b8d",
162 | "#00a6a8",
163 | "#00c3c4",
164 | "#00e1e1",
165 | "#00ffff",
166 | ]
167 |
168 | greens = [
169 | "#002100",
170 | "#003900",
171 | "#005200",
172 | "#006c00",
173 | "#0e880a",
174 | "#3aa22b",
175 | "#59bd46",
176 | "#75d860",
177 | "#91f479",
178 | ]
179 |
180 | oranges = [
181 | "#ffc54e",
182 | "#ffa122",
183 | "#f18100",
184 | "#d56a00",
185 | "#b95300",
186 | "#9e3d00",
187 | "#842600",
188 | "#6b0a00",
189 | "#4b0000",
190 | ]
191 |
192 | purples = [
193 | "#47004c",
194 | "#68006a",
195 | "#880c87",
196 | "#a02f9e",
197 | "#b948b6",
198 | "#d261ce",
199 | "#ec79e7",
200 | "#fd98fb",
201 | "#ffc0ff",
202 | ]
203 |
204 | reds = [
205 | "#780000",
206 | "#940000",
207 | "#b10000",
208 | "#cf0000",
209 | "#ed0000",
210 | "#ff361d",
211 | "#ff663f",
212 | "#ff875a",
213 | "#ffa473",
214 | ]
215 |
216 |
217 | class Diverging:
218 | """Color palettes with gradients ranging from one color to another"""
219 |
220 | blueorange = [
221 | "#00008b",
222 | "#3220c4",
223 | "#5f4bde",
224 | "#8278ea",
225 | "#9ca7ec",
226 | "#fcbf67",
227 | "#e68b1e",
228 | "#c25b01",
229 | "#963200",
230 | "#670600",
231 | ]
232 |
233 | orangeblue = blueorange[::-1]
234 |
235 | bluepurple = [
236 | "#1f0c97",
237 | "#5335c4",
238 | "#845bee",
239 | "#b889f8",
240 | "#e4bafd",
241 | "#fdb2fd",
242 | "#e37ce2",
243 | "#be4fbb",
244 | "#922891",
245 | "#630065",
246 | ]
247 |
248 | purpleblue = bluepurple[::-1]
249 |
250 | bluered = [
251 | "#00008b",
252 | "#392a9b",
253 | "#564baa",
254 | "#6f6db9",
255 | "#8590c8",
256 | "#99b3d7",
257 | "#ff9c96",
258 | "#fc7463",
259 | "#ea513d",
260 | "#d1301f",
261 | "#b11109",
262 | "#8b0000",
263 | ]
264 |
265 | redblue = bluered[::-1]
266 |
267 | greenpurple = [
268 | "#003b00",
269 | "#106210",
270 | "#238c23",
271 | "#51b64a",
272 | "#83df76",
273 | "#fdb2fd",
274 | "#e37ce2",
275 | "#be4fbb",
276 | "#922891",
277 | "#630065",
278 | ]
279 |
280 | purplegreen = greenpurple[::-1]
281 |
282 | greenred = [
283 | "#003b00",
284 | "#0d5b0d",
285 | "#1b7e1c",
286 | "#3aa136",
287 | "#60c457",
288 | "#98e48e",
289 | "#ff9c96",
290 | "#fc7463",
291 | "#ea513d",
292 | "#d1301f",
293 | "#b11109",
294 | "#8b0000",
295 | ]
296 |
297 | redgreen = greenred[::-1]
298 |
--------------------------------------------------------------------------------
/pyplot_themes/rcmod.py:
--------------------------------------------------------------------------------
1 | import matplotlib as mpl
2 | from pyplot_themes import themes as themes
3 |
4 | def grid_style(grid=True):
5 | """toggle grid on/off"""
6 | grid_style = {
7 | "axes.grid": False,
8 | }
9 | # Set grid on or off
10 | if grid:
11 | grid_style.update({
12 | "axes.grid": True,
13 | "grid.linestyle": "-",
14 | })
15 | return grid_style
16 |
17 |
18 | def axes_ticks_style(ticks=True):
19 | """toggle axes ticks on/off"""
20 | ticks_style = {
21 | "xtick.bottom": False,
22 | "ytick.left": False,
23 | }
24 | # Show or hide the axes ticks
25 | if ticks:
26 | ticks_style.update({
27 | "xtick.bottom": True,
28 | "ytick.left": True,
29 | })
30 | return ticks_style
31 |
32 |
33 | def theme_style(params=None, palette=None, grid=True, ticks=True, figsize=[12.0, 8.0]):
34 | """Return a parameter dict for the aesthetic style of the plots.
35 | This affects things like the color of the axes, whether a grid is
36 | enabled by default, and other aesthetic elements.
37 | Parameters
38 | ----------
39 | params : dict, None
40 | A dictionary of parameters, typically provided by calling a theme.
41 | palette : list, None
42 | A list of hex values to use as the color palette
43 | grid : bool, True
44 | A toggle for whether to use gridlines.
45 | ticks : bool, True
46 | A toggle for whether to use tick marks.
47 | figsize : list or tupe, [12.0, 8.0]
48 | The width and height of plots, defaults to 12 by 8.
49 | """
50 | if isinstance(params, dict):
51 | style_dict = params
52 | else:
53 | style_dict = themes._theme_minimal()
54 |
55 | if palette is not None:
56 | pal_style = {
57 | "axes.prop_cycle": themes.create_palette(palette),
58 | }
59 | style_dict.update(pal_style)
60 |
61 | if grid is not None:
62 | grids_params = grid_style(grid=grid)
63 | style_dict.update(grids_params)
64 |
65 | if ticks is not None:
66 | tick_params = axes_ticks_style(ticks=ticks)
67 | style_dict.update(tick_params)
68 |
69 | if figsize is not None:
70 | style_dict.update({"figure.figsize": figsize})
71 |
72 | return style_dict
73 |
74 |
75 | def set_style(style_params):
76 | """Pass a dict of style params to matplotlib
77 | Paramaters
78 | ----------
79 | style_params : dict, style params used to override matplotlib.rcParams
80 | """
81 | mpl.rcParams.update(style_params)
82 |
83 |
84 | def dark_settings():
85 | # Set the color of the background, spines, and grids
86 | return {
87 | "axes.facecolor": "#2E2E30",
88 | "axes.edgecolor": "#EEEEEE",
89 | "grid.color": "#EEEEEE",
90 | "axes.spines.left": True,
91 | "axes.spines.bottom": True,
92 | "axes.spines.right": True,
93 | "axes.spines.top": True,
94 | }
95 |
96 |
97 |
--------------------------------------------------------------------------------
/pyplot_themes/themes.py:
--------------------------------------------------------------------------------
1 | import warnings
2 | from cycler import cycler
3 | import matplotlib.colors as colors
4 | import matplotlib.pyplot as plt
5 | import pyplot_themes.rcmod as rcmod
6 | import pyplot_themes.palettes as palettes
7 | from matplotlib.cbook.deprecation import MatplotlibDeprecationWarning
8 |
9 |
10 | def theme_matplotlib_default(notebook=True):
11 | with warnings.catch_warnings():
12 | warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
13 | default_rcparams = {k: v for k, v in plt.rcParamsDefault.items()}
14 | notebook_settings = {
15 | "figure.dpi": 72.0,
16 | "figure.edgecolor": (1, 1, 1, 0),
17 | "figure.facecolor": (1, 1, 1, 0),
18 | "figure.figsize": [6.0, 4.0],
19 | "figure.subplot.bottom": 0.125,
20 | "interactive": True,
21 | }
22 | if notebook:
23 | default_rcparams.update(notebook_settings)
24 | rcmod.set_style(default_rcparams)
25 |
26 |
27 | # alias
28 | theme_reset = theme_matplotlib_default
29 |
30 |
31 | def find_color_hex_value(color="black"):
32 | """Helper function to retrieve color hex value by name
33 | Parameters
34 | ----------
35 | color : str, black
36 | The name of the color you find the hex value of, useful for
37 | building new color palettes.
38 | """
39 | # try CSS4 colors
40 | hex_value = colors.CSS4_COLORS.get(color)
41 | # try xkcd colors
42 | if hex_value is None:
43 | hex_value = colors.XKCD_COLORS.get(f"xkcd:{color}")
44 | if hex_value is None:
45 | berkeley = {d["name"]: d["hex_value"] for d in palettes.UCBerkeley.info}
46 | hex_value = berkeley.get(color)
47 | if hex_value is None:
48 | print(f"The Color {color} was not found in available colors.")
49 | raise
50 | return hex_value
51 |
52 |
53 | def list_available_colors():
54 | """Return a dict of all available colors by name and hex value.
55 | Note that some colors have multiple definitions because... reasons.
56 | """
57 | xkcd = {k.strip("xkcd:"): v for k, v in colors.XKCD_COLORS.items()}
58 | css4 = colors.CSS4_COLORS
59 | berkeley = {d["name"]: d["hex_value"] for d in palettes.UCBerkeley.info}
60 | all_colors = {**xkcd, **css4, **berkeley}
61 | return all_colors
62 |
63 |
64 | def create_palette(hex_values):
65 | """Helper function to build a repeating list of colors for matplotlib
66 | Parameters
67 | ----------
68 | hex_values : list or iterable
69 | A list of hex values for colors to use as a color palette
70 | Examples
71 | --------
72 | >>>
73 | """
74 | return cycler("color", hex_values)
75 |
76 |
77 | def _theme_minimal():
78 | """A decent, minimal theme"""
79 | colorblind = [v for v in palettes.Colorblind.colors]
80 | light_gray = find_color_hex_value("lightgray")
81 | dark_gray = find_color_hex_value("gray")
82 | style_dict = {
83 | "grid.color": light_gray,
84 | "figure.facecolor": "white",
85 | "xtick.direction": "out",
86 | "ytick.direction": "out",
87 | "xtick.color": dark_gray,
88 | "ytick.color": dark_gray,
89 | "text.color": dark_gray,
90 | "font.size": 14.0,
91 | "font.family": ["sans-serif"],
92 | "font.sans-serif": ["Arial", "DejaVu Sans", "sans-serif"],
93 | "lines.solid_capstyle": "round",
94 | "patch.edgecolor": "w",
95 | "patch.force_edgecolor": True,
96 | "image.cmap": "rocket",
97 | "xtick.top": False,
98 | "ytick.right": False,
99 | "axes.labelcolor": dark_gray,
100 | "axes.axisbelow": True,
101 | "axes.facecolor": "white",
102 | "axes.edgecolor": light_gray,
103 | "axes.spines.left": True,
104 | "axes.spines.bottom": True,
105 | "axes.spines.right": True,
106 | "axes.spines.top": True,
107 | "axes.prop_cycle": create_palette(colorblind),
108 | }
109 | return style_dict
110 |
111 |
112 | def theme_minimal(palette=None, grid=True, ticks=True, figsize=None, fontsize=None):
113 | """A decent, minimal theme
114 | Parameters
115 | ----------
116 | palette : list, None
117 | A list of hex values to pass in as a color palette
118 | grid : bool, True
119 | Toggle gridlines on/off
120 | axes : bool, True
121 | Toggle tick marks on/off
122 | figsize : list or tuple, None
123 | Sets the figsize for plots, for example ``figsize=[9,6]``
124 | fontsize : int or float, None
125 | Sets the font size for plots, for example ``fontsize=12.5``
126 | """
127 | if figsize is None:
128 | figsize = [12.0, 8.0]
129 | style = rcmod.theme_style(None, palette, grid, ticks, figsize)
130 | if fontsize is not None:
131 | style.update({"font.size": fontsize})
132 | rcmod.set_style(style)
133 |
134 |
135 | def theme_dark(palette=None, grid=True, ticks=True, figsize=None, fontsize=None):
136 | """A decent, minimal dark theme
137 | Parameters
138 | ----------
139 | palette : list, None
140 | A list of hex values to pass in as a color palette
141 | grid : bool, True
142 | Toggle gridlines on/off
143 | axes : bool, True
144 | Toggle tick marks on/off
145 | figsize : list or tuple, None
146 | Sets the figsize for plots, for example ``figsize=[9,6]``
147 | fontsize : int or float, None
148 | Sets the font size for plots, for example ``fontsize=12.5``
149 | """
150 | if figsize is None:
151 | figsize = [12.0, 8.0]
152 | style = rcmod.theme_style(None, palette, grid, ticks, figsize)
153 | dark_style = rcmod.dark_settings()
154 | if palette is None:
155 | darkcolorblind = [v for v in palettes.Colorblind.colors][1:]
156 | dark_style.update({"axes.prop_cycle": create_palette(darkcolorblind)})
157 | style.update(dark_style)
158 | if fontsize is not None:
159 | style.update({"font.size": fontsize})
160 | rcmod.set_style(style)
161 |
162 |
163 | def theme_tableau(grid=True, ticks=True, figsize=None, fontsize=None):
164 | """Theme based on the defaults in Tableau
165 | Parameters
166 | ----------
167 | grid : bool, True
168 | Toggle gridlines on/off
169 | axes : bool, True
170 | Toggle tick marks on/off
171 | figsize : list or tuple, None
172 | Sets the figsize for plots, for example ``figsize=[9,6]``
173 | fontsize : int or float, None
174 | Sets the font size for plots, for example ``fontsize=12.5``
175 | """
176 | if figsize is None:
177 | figsize = [12.0, 8.0]
178 | tableau_colors = [v for v in colors.TABLEAU_COLORS.values()]
179 | style = rcmod.theme_style(None, tableau_colors, grid, ticks, figsize)
180 | if fontsize is not None:
181 | style.update({"font.size": fontsize})
182 | rcmod.set_style(style)
183 |
184 |
185 | def theme_solarized(scheme="dark", grid=True, ticks=True, figsize=None, fontsize=None):
186 | """Theme based on the defaults in Tableau
187 | Parameters
188 | ----------
189 | scheme : str, dark or light
190 | Use one of dark or light solarized color schemes
191 | grid : bool, True
192 | Toggle gridlines on/off
193 | axes : bool, True
194 | Toggle tick marks on/off
195 | figsize : list or tuple, None
196 | Sets the figsize for plots, for example ``figsize=[9,6]``
197 | fontsize : int or float, None
198 | Sets the font size for plots, for example ``fontsize=12.5``
199 | """
200 | if figsize is None:
201 | figsize = [12.0, 8.0]
202 | if scheme == "dark":
203 | # want colors to show up, so use opposite
204 | solarized_colors = palettes.Solarized.light
205 | fig_color = solarized_colors[-1]
206 | ax_color = solarized_colors[-2]
207 | pal_colors = solarized_colors[:-2]
208 | elif scheme == "light":
209 | # want colors to show up, so use opposite
210 | solarized_colors = palettes.Solarized.dark
211 | fig_color = solarized_colors[-1]
212 | ax_color = solarized_colors[-2]
213 | pal_colors = solarized_colors[:-2]
214 | else:
215 | print("Scheme must be one of dark or light")
216 | raise
217 | style = rcmod.theme_style(None, pal_colors, grid, ticks, figsize)
218 | style.update(
219 | {
220 | "figure.facecolor": fig_color,
221 | "axes.facecolor": fig_color,
222 | "axes.labelcolor": ax_color,
223 | }
224 | )
225 | if fontsize is not None:
226 | style.update({"font.size": fontsize})
227 | rcmod.set_style(style)
228 |
229 |
230 | def theme_paul_tol(reverse_colors=False, grid=True, ticks=True, figsize=None, fontsize=None):
231 | """Theme based on the defaults in Tableau
232 | Parameters
233 | ----------
234 | reverse : bool, False
235 | Toggle color palette order forward or reverse
236 | grid : bool, True
237 | Toggle gridlines on/off
238 | axes : bool, True
239 | Toggle tick marks on/off
240 | figsize : list or tuple, None
241 | Sets the figsize for plots, for example ``figsize=[9,6]``
242 | fontsize : int or float, None
243 | Sets the font size for plots, for example ``fontsize=12.5``
244 | """
245 | if figsize is None:
246 | figsize = [12.0, 8.0]
247 | pal_colors = palettes.PaulTolColorSchemes.colors
248 | if reverse_colors:
249 | pal_colors = pal_colors[::-1]
250 | style = rcmod.theme_style(None, pal_colors, grid, ticks, figsize)
251 | if fontsize is not None:
252 | style.update({"font.size": fontsize})
253 | rcmod.set_style(style)
254 |
255 |
256 | def theme_few(scheme="medium", grid=False, ticks=True, figsize=None, fontsize=None):
257 | """Theme based on the ideas of Stephen Few
258 | Parameters
259 | ----------
260 | scheme : str, medium, or dark or light
261 | Use one of dark or light solarized color schemes
262 | grid : bool, False
263 | Toggle gridlines on/off
264 | axes : bool, True
265 | Toggle tick marks on/off
266 | figsize : list or tuple, None
267 | Sets the figsize for plots, for example ``figsize=[9,6]``
268 | fontsize : int or float, None
269 | Sets the font size for plots, for example ``fontsize=12.5``
270 | """
271 | if figsize is None:
272 | figsize = [12.0, 8.0]
273 | if scheme == "medium":
274 | pal_colors = palettes.Few.medium
275 | elif scheme == "light":
276 | pal_colors = palettes.Few.light
277 | elif scheme == "dark":
278 | pal_colors = palettes.Few.dark
279 | else:
280 | print("Few color scheme must be one of medium, light, or dark.")
281 | raise
282 | few_style = {
283 | "text.color": "black",
284 | "axes.labelcolor": "black",
285 | "xtick.color": "black",
286 | "ytick.color": "black",
287 | }
288 | style = rcmod.theme_style(few_style, pal_colors, grid, ticks, figsize)
289 | if fontsize is not None:
290 | style.update({"font.size": fontsize})
291 | rcmod.set_style(style)
292 |
293 |
294 | def theme_ucberkeley(scheme="primary", grid=False, ticks=True, figsize=None, fontsize=None):
295 | """Theme based on the brand guidelines of Univeristy of California, Berkeley.
296 | https://brand.berkeley.edu/
297 |
298 | If you want to use the theme's default font, Open Sans, you may need to
299 | download and install it from: https://www.fontsquirrel.com/fonts/open-sans
300 |
301 | Parameters
302 | ----------
303 | scheme : str, primary, secondary or all
304 | Use one of primary, secondary, or all colors in the UC Berkeley palette
305 | grid : bool, False
306 | Toggle gridlines on/off
307 | axes : bool, True
308 | Toggle tick marks on/off
309 | figsize : list or tuple, None
310 | Sets the figsize for plots, for example ``figsize=[9,6]``
311 | fontsize : int or float, None
312 | Sets the font size for plots, for example ``fontsize=12.5``
313 | """
314 | if figsize is None:
315 | figsize = [12.0, 8.0]
316 | if scheme == "primary":
317 | pal_colors = palettes.UCBerkeley.primary_colors
318 | elif scheme == "secondary":
319 | pal_colors = palettes.UCBerkeley.secondary_colors
320 | elif scheme == "all":
321 | pal_colors = palettes.UCBerkeley.colors
322 | else:
323 | print("UCBerkeley color scheme must be one of primary, secondary, or all.")
324 | raise
325 | ucb_style = {
326 | "grid.color": "#EEEEEE",
327 | "figure.facecolor": "#FFFFFF",
328 | "text.color": "#003262",
329 | "axes.labelcolor": "#003262",
330 | "xtick.color": "#888888",
331 | "ytick.color": "#888888",
332 | "axes.edgecolor": "#EEEEEE",
333 | "axes.spines.left": True,
334 | "axes.spines.bottom": True,
335 | "axes.spines.right": False,
336 | "axes.spines.top": False,
337 | "font.family": ["sans-serif"],
338 | "font.sans-serif": ["Open Sans", "DejaVu Sans", "sans-serif"],
339 | "axes.facecolor": "white",
340 | }
341 | style = rcmod.theme_style(ucb_style, pal_colors, grid, ticks, figsize)
342 | if fontsize is not None:
343 | style.update({"font.size": fontsize})
344 | rcmod.set_style(style)
345 |
346 |
347 | def _get_mpl_style_params(style):
348 | """Helper function to get the rcParams defined in existing matplotlib styles
349 | Parameters
350 | ----------
351 | style : str, the name of an existing style from matplotlib.pyplot.style.available
352 | """
353 | if style not in plt.style.available:
354 | print(f"Style ``{style}`` is not available")
355 | raise
356 | params = {k: v for k, v in plt.style.library.get(style).items()}
357 | return params
358 |
359 |
360 | def theme_fivethirtyeight(grid=None, ticks=None, figsize=None, fontsize=None):
361 | """Use the matplotlib fivethirtyeight style
362 | Parameters
363 | ----------
364 | grid : bool, True
365 | Toggle gridlines on/off
366 | axes : bool, True
367 | Toggle tick marks on/off
368 | figsize : list or tuple, None
369 | Sets the figsize for plots, for example ``figsize=[9,6]``
370 | fontsize : int or float, None
371 | Sets the font size for plots, for example ``fontsize=12.5``
372 | """
373 | fivethirtyeight_style = _get_mpl_style_params("fivethirtyeight")
374 | style = rcmod.theme_style(fivethirtyeight_style, None, grid, ticks, figsize)
375 | if fontsize is not None:
376 | style.update({"font.size": fontsize})
377 | rcmod.set_style(style)
378 |
379 |
380 | def theme_ggplot2(palette=None, grid=None, ticks=None, figsize=None, fontsize=None):
381 | """Use the matplotlib ggplot style
382 | Parameters
383 | ----------
384 | palette : list, None
385 | A list of hex values to pass in as a color palette
386 | grid : bool, True
387 | Toggle gridlines on/off
388 | axes : bool, True
389 | Toggle tick marks on/off
390 | figsize : list or tuple, None
391 | Sets the figsize for plots, for example ``figsize=[9,6]``
392 | fontsize : int or float, None
393 | Sets the font size for plots, for example ``fontsize=12.5``
394 | """
395 | ggplot_style = _get_mpl_style_params("ggplot")
396 | style = rcmod.theme_style(ggplot_style, palette, grid, ticks, figsize)
397 | if fontsize is not None:
398 | style.update({"font.size": fontsize})
399 | rcmod.set_style(style)
400 |
401 |
402 | def theme_solarized_light2(grid=None, ticks=None, figsize=None, fontsize=None):
403 | """Use the matplotlib Solarize_Light2 style
404 | Parameters
405 | ----------
406 | grid : bool, True
407 | Toggle gridlines on/off
408 | axes : bool, True
409 | Toggle tick marks on/off
410 | figsize : list or tuple, None
411 | Sets the figsize for plots, for example ``figsize=[9,6]``
412 | fontsize : int or float, None
413 | Sets the font size for plots, for example ``fontsize=12.5``
414 | """
415 | sl_style = _get_mpl_style_params("Solarize_Light2")
416 | style = rcmod.theme_style(sl_style, None, grid, ticks, figsize)
417 | if fontsize is not None:
418 | style.update({"font.size": fontsize})
419 | rcmod.set_style(style)
420 |
421 |
422 | def theme_bmh(palette=None, grid=None, ticks=None, figsize=None, fontsize=None):
423 | """Use the matplotlib bmh style
424 | Parameters
425 | ----------
426 | grid : bool, True
427 | Toggle gridlines on/off
428 | axes : bool, True
429 | Toggle tick marks on/off
430 | figsize : list or tuple, None
431 | Sets the figsize for plots, for example ``figsize=[9,6]``
432 | fontsize : int or float, None
433 | Sets the font size for plots, for example ``fontsize=12.5``
434 | """
435 | bmh_style = _get_mpl_style_params("bmh")
436 | style = rcmod.theme_style(bmh_style, palette, grid, ticks, figsize)
437 | if fontsize is not None:
438 | style.update({"font.size": fontsize})
439 | rcmod.set_style(style)
440 |
441 |
442 | theme_bayesian_methods_for_hackers = theme_bmh
443 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | # Note: To use the 'upload' functionality of this file, you must:
5 | # $ pipenv install twine --dev
6 |
7 | import io
8 | import os
9 | import sys
10 | from shutil import rmtree
11 |
12 | from setuptools import find_packages, setup, Command
13 |
14 | # Package meta-data.
15 | NAME = 'pyplot-themes'
16 | DESCRIPTION = 'Easily set themes that automatically apply to matplotlib, seaborn, and pandas plots'
17 | URL = 'https://github.com/raybuhr/pyplot-themes'
18 | EMAIL = 'raymond.buhr@gmail.com'
19 | AUTHOR = 'Ray Buhr'
20 | REQUIRES_PYTHON = '>=3.6.0'
21 | VERSION = None # set in pyplot_themes/__version__.py
22 |
23 | # What packages are required for this module to be executed?
24 | REQUIRED = [
25 | "matplotlib"
26 | ]
27 |
28 | # What packages are optional?
29 | EXTRAS = {
30 | # 'fancy feature': ['django'],
31 | }
32 |
33 | # The rest you shouldn't have to touch too much :)
34 | # ------------------------------------------------
35 | # Except, perhaps the License and Trove Classifiers!
36 | # If you do change the License, remember to change the Trove Classifier for that!
37 |
38 | here = os.path.abspath(os.path.dirname(__file__))
39 |
40 | # Import the README and use it as the long-description.
41 | # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
42 | try:
43 | with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
44 | long_description = '\n' + f.read()
45 | except FileNotFoundError:
46 | long_description = DESCRIPTION
47 |
48 | # Load the package's __version__.py module as a dictionary.
49 | about = {}
50 | if not VERSION:
51 | project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
52 | with open(os.path.join(here, project_slug, '__version__.py')) as f:
53 | exec(f.read(), about)
54 | else:
55 | about['__version__'] = VERSION
56 |
57 |
58 | class UploadCommand(Command):
59 | """Support setup.py upload."""
60 |
61 | description = 'Build and publish the package.'
62 | user_options = []
63 |
64 | @staticmethod
65 | def status(s):
66 | """Prints things in bold."""
67 | print('\033[1m{0}\033[0m'.format(s))
68 |
69 | def initialize_options(self):
70 | pass
71 |
72 | def finalize_options(self):
73 | pass
74 |
75 | def run(self):
76 | try:
77 | self.status('Removing previous builds…')
78 | rmtree(os.path.join(here, 'dist'))
79 | except OSError:
80 | pass
81 |
82 | self.status('Building Source and Wheel (universal) distribution…')
83 | os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
84 |
85 | self.status('Uploading the package to PyPI via Twine…')
86 | os.system('twine upload dist/*')
87 |
88 | self.status('Pushing git tags…')
89 | os.system('git tag v{0}'.format(about['__version__']))
90 | os.system('git push --tags')
91 |
92 | sys.exit()
93 |
94 |
95 |
96 | # Where the magic happens:
97 | setup(
98 | name=NAME,
99 | version=about['__version__'],
100 | description=DESCRIPTION,
101 | long_description=long_description,
102 | long_description_content_type='text/markdown',
103 | author=AUTHOR,
104 | author_email=EMAIL,
105 | python_requires=REQUIRES_PYTHON,
106 | url=URL,
107 | packages=find_packages(exclude=["example_files", "tests", "*.tests", "*.tests.*", "tests.*"]),
108 | # If your package is a single module, use this instead of 'packages':
109 | # py_modules=['pyplot_themes'],
110 |
111 | # entry_points={
112 | # 'console_scripts': ['mycli=mymodule:cli'],
113 | # },
114 | install_requires=REQUIRED,
115 | extras_require=EXTRAS,
116 | include_package_data=True,
117 | license='MIT',
118 | classifiers=[
119 | # Trove classifiers
120 | # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
121 | 'License :: OSI Approved :: MIT License',
122 | 'Programming Language :: Python',
123 | 'Programming Language :: Python :: 3',
124 | 'Programming Language :: Python :: 3.6',
125 | 'Programming Language :: Python :: Implementation :: CPython',
126 | 'Programming Language :: Python :: Implementation :: PyPy'
127 | ],
128 | # $ setup.py publish support.
129 | cmdclass={
130 | 'upload': UploadCommand,
131 | },
132 | )
133 |
--------------------------------------------------------------------------------