Python ошибка при установке matplotlib

  • Редакция Кодкампа

17 авг. 2022 г.
читать 1 мин


Одна распространенная ошибка, с которой вы можете столкнуться при использовании Python:

no module named ' matplotlib '

Эта ошибка возникает, когда Python не обнаруживает библиотеку matplotlib в вашей текущей среде.

В этом руководстве представлены точные шаги, которые вы можете использовать для устранения этой ошибки.

Шаг 1: pip устанавливает matplotlib

Поскольку matplotlib не устанавливается автоматически вместе с Python, вам нужно будет установить его самостоятельно. Самый простой способ сделать это — использовать pip , менеджер пакетов для Python.

Вы можете запустить следующую команду pip для установки matplotlib:

pip install matplotlib

В большинстве случаев это исправит ошибку.

Шаг 2: Установите пип

Если вы все еще получаете сообщение об ошибке, вам может потребоваться установить pip. Используйте эти шаги , чтобы сделать это.

Вы также можете использовать эти шаги для обновления pip до последней версии, чтобы убедиться, что он работает.

Затем вы можете запустить ту же команду pip, что и раньше, чтобы установить matplotlib:

pip install matplotlib

На этом этапе ошибка должна быть устранена.

Шаг 3: проверьте версии matplotlib и pip

Если вы все еще сталкиваетесь с ошибками, возможно, вы используете другую версию matplotlib и pip.

Вы можете использовать следующие команды, чтобы проверить, совпадают ли ваши версии matplotlib и pip:

which python
python --version
which pip

Если две версии не совпадают, вам нужно либо установить более старую версию matplotlib, либо обновить версию Python.

Шаг 4: Проверьте версию matplotlib

После того, как вы успешно установили matplotlib, вы можете использовать следующую команду, чтобы отобразить версию matplotlib в вашей среде:

pip show matplotlib

Name: matplotlib
Version: 3.1.3
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: /srv/conda/envs/notebook/lib/python3.7/site-packages
Requires: cycler, numpy, kiwisolver, python-dateutil, pyparsing
Required-by: seaborn, scikit-image
Note: you may need to restart the kernel to use updated packages.

Примечание. Самый простой способ избежать ошибок с версиями matplotlib и Python — просто установить Anaconda , набор инструментов, предустановленный вместе с Python и matplotlib и бесплатный для использования.

Дополнительные ресурсы

В следующих руководствах объясняется, как исправить другие распространенные проблемы в Python:

Как исправить: нет модуля с именем numpy
Как исправить: нет модуля с именем plotly
Как исправить: имя NameError ‘pd’ не определено
Как исправить: имя NameError ‘np’ не определено

The error “ModuleNotFoundError: No module named matplotlib» is a common error experienced by data scientists when developing in Python. The error is likely an environment issue whereby the matplotlib package has not been installed correctly on your machine, thankfully there are a few simple steps to go through to troubleshoot the problem and find a solution.

Your error, whether in a Jupyter Notebook or in the terminal, probably looks like one of the following:

No module named 'matplotlib'
ModuleNotFoundError: No module named 'matplotlib'

In order to find the root cause of the problem we will go through the following potential fixes:

  1. Upgrade pip version
  2. Upgrade or install matplotlib package
  3. Check if you are activating the environment before running
  4. Create a fresh environment
  5. Upgrade or install Jupyer Notebook package

Are you installing packages using Conda or Pip package manager?

It is common for developers to use either Pip or Conda for their Python package management. It’s important to know what you are using before we continue with the fix.

If you have not explicitly installed and activated Conda, then you are almost definitely going to be using Pip. One sanity check is to run conda info in your terminal, which if it returns anything likely means you are using Conda.

Upgrade or install pip for Python

First things first, let’s check to see if we have the up to date version of pip installed. We can do this by running:

pip install --upgrade pip

Upgrade or install matplotlib package via Conda or Pip

The most common reason for this error is that the matplotlib package is not installed in your environment or an outdated version is installed. So let’s update the package or install it if it’s missing.

For Conda:

# To install in the root environment 
conda install matplotlib 

# To install in a specific environment 
conda install -n MY_ENV matplotlib

For Pip:‌

# To install in the root environment
python3 -m pip install -U matplotlib

# To install in a specific environment
source MY_ENV/bin/activate
python3 -m pip install -U matplotlib

Activate Conda or venv Python environment

It is highly recommended that you use isolated environments when developing in Python. Because of this, one common mistake developers make is that they don’t activate the correct environment before they run the Python script or Jupyter Notebook. So, let’s make sure you have your correct environment running.

For Conda:

conda activate MY_ENV

For virtual environments:

source MY_ENV/bin/activate

Create a new Conda or venv Python environment with matplotlib installed

During the development process, a developer will likely install and update many different packages in their Python environment, which can over time cause conflicts and errors.

Therefore, one way to solve the module error for matplotlib is to simply create a new environment with only the packages that you require, removing all of the bloatware that has built up over time. This will provide you with a fresh start and should get rid of problems that installing other packages may have caused.

For Conda:

# Create the new environment with the desired packages
conda create -n MY_ENV python=3.9 matplotlib 

# Activate the new environment 
conda activate MY_ENV 

# Check to see if the packages you require are installed 
conda list

For virtual environments:

# Navigate to your project directory 
cd MY_PROJECT 

# Create the new environment in this directory 
python3 -m venv MY_ENV 

# Activate the environment 
source MY_ENV/bin/activate 

# Install matplotlib 
python3 -m pip install matplotlib

Upgrade Jupyter Notebook package in Conda or Pip

If you are working within a Jupyter Notebook and none of the above has worked for you, then it could be that your installation of Jupyter Notebooks is faulty in some way, so a reinstallation may be in order.

For Conda:

conda update jupyter

For Pip:

pip install -U jupyter

Best practices for managing Python packages and environments

Managing packages and environments in Python is notoriously problematic, but there are some best practices which should help you to avoid package the majority of problems in the future:

  1. Always use separate environments for your projects and avoid installing packages to your root environment
  2. Only install the packages you need for your project
  3. Pin your package versions in your project’s requirements file
  4. Make sure your package manager is kept up to date

References

Conda managing environments documentation
Python venv documentation

Comments

@KushalSharma19

mwaskom

added a commit
to mwaskom/seaborn
that referenced
this issue

Oct 26, 2020

@mwaskom

mwaskom

added a commit
to mwaskom/seaborn
that referenced
this issue

Oct 29, 2020

@mwaskom

mwaskom

added a commit
to mwaskom/seaborn
that referenced
this issue

Oct 29, 2020

@mwaskom

millerda

added a commit
to millerda/seaborn
that referenced
this issue

Apr 26, 2021

* Ignore otherwise unavoidable warnings in conftest.ini

* Remove old Makefile targets for Stanford website

* Update table css to not break API page

* Update Python kernel that is hardcoded into notebooks

* Fix thumbnail on gallery page

* Include tests in lint check

* PEP8 on Py27

* Force alphabetical sort of example gallery thumbs

* Add file with pinned versions of doc dependencies

* Add v0.9.1 to release notes page

* Add a relplot example to line/scatterplot

Closes #1664

* Add intersphinx links where kwargs are defined

Closes #1937

* Update to reflect new example data

* New pytest breaks coverage?

* Update release notes

* Update install docs to reflect new minimum dependencies

[ci skip]

* Fix gallery generator

* Release notes text

* More improvements to clustergrid layout

This enables use of tight_layout within clustermap. Ideally most plots will
now have everything in the figure and looking nice out of the box. It uses
a somewhat hacky approach that should be revisted as constrained_layout matures.

Also updates the docs a little bit and adds a rule where cbar_pos=None implies
that no colorbar will be drawn.

* Improve clustermap API examples

* Remove commented code

[ci skip]

* Add thumbnail images on the tutorial homepage

* Drop Python 2 from setup files

* Excise six

* Drop 2.7 (and 3.5) from travis build

* Remove references to 2.7 from README/docs

* Make tutorial thumbnails link to relevant page

* Modernize minimal dependencies

* Reorganize 0.9.1 feature notes

* Explicitly error in setup on Python < 3.6

* Remove smooth bootstrap

* Remove seaborn.timeseries

* Remove seaborn.linearmodels

* Remove seaborn.apionly

* Remove top-level import of timeseries module

* Add link to website footer

* Add version 0.10 release notes

* Update version for 0.10.0 release candidate

* Release v0.10.0.rc0

* Make dogplot more tolerant

I really like this easter egg :-)

However, when you suggest someone to use `dogplot` instead of `catplot`, they will receive a `TypeError` explaining that they provided too many arguments. This kind of spoils the fun. What about making it more tolerant?

* Add a pandas API link in introduction

* Bump version for v0.10 release

* Fix a few things in the docs

* Release v0.10.0

* Tweak release notes

* Bump version back to dev on master

* Add 0.9.1 and 0.10.0 DOI badges

* Use the correct platform integer type

`np.array.take` requires that the index be the platform integer type (`int32` for 32bit and `int64` for 64bit), but `np.random.RandomState.randint` returns an `int64` on any platform by default.  This makes sure it returns the right type of integer for the current platform.

Fixes mwaskom#1950

* Fix release notes link

* Add 0.10.1 release notes file and mention bootstrap fix

* DOC: update truncate parameter string to reflect new default (#1961)

* Use numpy's indexing dtype in bootstrap (#1968)

Follow-up to #1952 that uses the correct dtype

* Don't fail in regplot on singletons, don't fit regression either (#1969)

* FIX: don't squeeze singletons

* Disable regression fit in case of singleton inputs

* Update release notes

[ci skip]

* Copy props from old cmap when creating new cmap in heatmap (#1948)

* preserve cmap props when centering

* preserve explicitly set extremes

* Update release notes

* added tests for sig_stars() function (#1972)

* added tests for sig_stars() function

Since the `sig_stars()` function in utils.py doesn't have tests. I added the test to increase the coverage test.

* fixed 5th case in test_sig_stars() function

* Changed the stars variables

* Removed whitespaces in blank lines

* FIX: Ignore masked cells when finding heatmap data limits (#1956)

* respect mask when setting heatmap limits

* respect mask when setting heatmap limits

* improve code style

* Update release notes

* Add deprecation notice for sig_stars (#1973)

* MNT: Remove unused code paths (#1965)

* TST: pandas==1.0 compat

* Remove old matplotlib paths

* Remove old scipy paths

* Remove _set_spine_position

The behavior that this function addressed has been resolved in matplotlib 1.4:
https://github.com/matplotlib/matplotlib/pull/3104

* Clean more old compat code paths

Removed a few try/except clauses aimed to cover old matplotlib/pandas
versions that are no longer supported.

* Remove __future__ imports

* Improve code style

* Make all links possible use https:// (#1985)

* FIX: avoid error when prop_cycle has no color (#1992)

* Rework get_color_cycle

* No longer fail when cycler has no color (fixes #1977)

* Improves docstring

* Adds tests

* default to dark gray

* remove redundant test

* Avoid error in despine when axis has matplotlib categories (#1991)

Fixes #1978

* Make remaining links use https:// (#1984) (#1988)

* python3-only to_utf8 (#1979)

Co-authored-by: Michael Waskom <mwaskom@users.noreply.github.com>

* Fix `add_legend` to always populate `_legend` (#1999)

Even when `legend_out` is False

* Fix test import

* Avoid floating point error with maximum husl sat/lum (#2000)

* homogenization to use _color_to_rgb and normalization of husl_to_rgb output in [0,1]

* added better test to husl_to_rgb input and output

* Use numpy function and improve tests

Co-authored-by: Ivan Gonzalez <scratchmex@gmail.com>

* Autoscale in swarmplot to get valid transform (#2017)

Fixes #2013

* Add optional argument showfliers for boxenplot (#2010)

* Add optional argument showfliers for boxenplot

Same API as matplotlib boxplot to show/hide markers beyond the box(es)

* Remove trailing whitespace

* Add default value (True) for showfliers parameter

* Fix doc of showfliers parameter

* Add test for boxenplot showfliers parameter

* Update release notes

* Added fix for minor typos in 0.9.1 release notes (#2019)

* Housekeeping in utilities module (#2035)

* Tweak some utitlity docstrings and deprecate percentiles function

percentiles is now redundant with numpy.percentile and had not been
used internally in some time.

* Switch from internal percentiles function to numpy.percentile

* Deprecate ci_to_errorsize and pmf_hist

Closes #2034

* Revert deprecation of ci_to_errsize

* Excise and deprecate sort_df

Closes #2033

* PEP8

* Update release notes

* Fix deprecation warning handling in tests

* ENH: Handle`legend.title_fontsize` rcparam (#2025)

* test legend title size

* don't ignore legend.title_fontsize rcparam

* add 'legend.title_fontsize' to context

* Update release notes

* Examples of ways to have the same mapping between facets (#2030)

* PEP8

* Avoid seeing an error from statsmodels in kdeplot when data IQR == 0 (#2040)

* Handle some small housekeeping items prior to releasing v0.10.1 (#2041)

Document functions supporting example data

Add v0.10.1 release notes to whatsnew page

Avoid matplotlib deprecation warning in boxplot example

* Finalize v0.10.1 release notes

* Add Zenodo DOI for v0.10.1

* Add explicit warning in swarmplot about gutters (#2045)

Currently set to warn when > 2% of the points overlap; with a little playing
around, this seemed like where the distribution started to get obscured.
But it is ad hoc.

* Make FacetGrid a bit more convenient (#2046)

* Add FacetGrid.axes_dict attribute

* Clear inner labels from FacetGrid when setting x/y labels

* Update release notes

* Require keyword arguments for most parameters (#2052)

* Enforce keyword-only arguments for all non-semantic parameters in plotting API

* Ignore vscode cruft

* Fix tests that use positional arguments

* Standardize function signature formatting

* Accept positional args past * and warn for next release cycle

* Converge on standard plotting function signatures

* Update tests to use keyword arguments

* Move development-related decorators to specific module

* Standardize parameter names in distributions module (#2060)

* Standardize parameter names in distributions module

* Compat with older statsmodels

* Improve kdeplot tests

* Stricter code linting

- Define fewer PEP8 exceptions
- Define flake8 config centrally
- Fix existing issues

* Stricter code linting (#2064)

- Define fewer PEP8 exceptions
- Define flake8 config centrally
- Fix existing issues

* Add tight_layout method on FacetGrid and PairGrid (#2073)

* Add Grid.tight_layout for legend-aware automatic layout

* Use Grid.tight_layout internally

* Refactor variable processing (#2071)

* Add initial common function for processing long-form inputs

* Attempt to use new core variable processing for longform relational plots

* Create and ignore a directory for notes

* Move relational plots to use common variable processing

* Refactor establish_variables method into core

* Allow relational plots to use wide lists of lists

* Change base class to _VectorPlotter

* Add initial attempt at generalized wide data processing

* Modify tests for new intermeidate wide-form data representation

* Remove relational-specific wide data processing

* Fold relplot tests under TestRelationalPlotter

* Move tests for core variable processing

* Revert test reorganization; PEP8 and clean up names

* Add tests for wide dict inputs

* Pandas compat

* Modernize numpy random usage in test fixtures

* Fix docstring and comments

* Use containment checks rather than KeyError handling

* Improve test coverage for long data and messy wide data

* Test variables from dataframe index

* Flesh out wide data docstring

* Return variables dict along with plot_data df

* First attempt at generalizing relplot inputs

* Refactor and parametrize flat variables tests

* Test at base class level

* Test relplot from wide data and long vectors

* Fix test

* Programmatically define arbitrarily large style mappings (#2075)

* Programatically define arbitrary dash specs

* Add unique default markers and update tests

* Don't pass MarkerStyle into plt.plot

This fails; see https://github.com/matplotlib/matplotlib/issues/17432

* Update release notes

* Emphasize that default dashes/markers are unique.

* Add refs to github PRs

* Scale the default scatterplot edge width by the point radius (#2078)

* Scale the default scatterplot edge width by the point radius

* Reorder operations in scatterplot plot

* Allow vectors for c= or s= in scatterplot (#2079)

* Improve FacetGrid margin titles to not show previous texts (#2083)

* Improve FacetGrid margin titles to not show previous texts

* Add ref to github issue

* Require keyword arguments almost everywhere (#2081)

* Require all args but `data` to have keywords

* Remove argument __repr__ from keyword warning

Fixes #2066

* Update internal code and docstring examples to use kwargs everywhere

* Don't fail on anonymous functions

* Add keyword arguments in gallery examples and tutorials

* Provide more information in the warning

* Centralize and modify variable type inference (#2084)

* Centralize and modify variable type inference

* Use core.variable_type elsewhere in the library

* Bump pinned pandas to avoid bug

* Test coverage

* Move orientation inference to core and improve error handling

* Parameterize necessity of numeric variable by plot type

* Tweak language

* Shorten parameter name

* Correct comment

* Tweak docs

* Deprecate iqr and axlabel; improve deprecation warning class (#2087)

* Deprecate iqr and axlabel; improve deprecation warning class

* Note deprecations

[ci skip]

* Refactor semantic mapping operations (#2090)

* Prototype of rugplot that passes original tests

* Update test style

* Implement idea for less-verbose interaction with Plotter classes

* Explore an idea about how to abstract hue mapping

* Shush Flake8

* Define semantics with tuples, not lists, to make immutable

* Define semantic mappings with some complex higher-order magic

* Move some of the hue mapping logic

* Continued refactoring of variable assignment and hue mapping

* Refactor lineplot and get tests to pass

* Get most RelationalPlotter tests passing

* Fix error introduced during refactoring

* Move hue mapping tests from test_relational to test_core

* Avoid treating string palette arg as signaling categorical

* Set map_type to include datetime, add note about missing implementation

* Change semantic inheritance to be restrictive rather than expansive

* Consider boolean data categorical at Plotter level

* Sort out where utils/core funcs should go

* Strip nose out of the utils tests

* Move new decorator to where it belongs and add a test

* Clean up a few leftovers from utils reorg

* Add more HueMapping tests

* Make core module private

* Make objects in core non-private

* Add initial version of SizeMapping object

* Messy first pass at replacing parse_size with SizeMapping

* Fix size mapping to match current behavior, defer decoupling from plotter

* Add test to capture relplot bug

* Fix relplot numeric hues

* Move all hue/size lookup logic into corresponding Mapping objects

* Finalize refactoring of size mapping

* Add prototype of StyleMapping

* Integrate StyleMapping into relational plots

* Get relational tests to pass

* Move StyleMapping tests to core and excise parse_style from relational

* Point rugplot at old code for now

* Add some more basic tests

* Treat units as a normal semantic

* Rename assign_variables method

* Address some TODOs about style/organization/defaults

* Address more small TODOs and flesh out docs

* LogNorm now fails with non-positive data (as it arguably should)

* Handle units in relplot (fixes #2080)

* Ignore false-alarm warning from numpy on string/number comparison

* Catch a few pieces of residual cruft

* Ignore a separate dubious numpy warning

* Improve test coverage

* Avoid error in relational user guide page

* Improve lineplot handling of mpl kwargs (#2095)

* Improve lineplot handling of mpl kwargs

Fixes #1526

* Update release notes

* Refactor method for getting semantic subsets down to core (#2097)

* Refactor method for getting semantic subsets down to core

* Require explicit grouping semantics

* Fix ordering bug by maintaining category metadata (#2099)

* Update docs (#2098)

* Update kdeplot example to use keyword-only arguments
* Update intersphinx path to numpy docs

* Fix typo and dud test (#2100)

* Add basic CI workflow

* Fix CI workflow

* Iterate CI

* Add doc build to CI

* Define kernel for doc build during CI

* Explicit install of deps and utils during CI

* Test docs during CI (#2109)

* Excecute gallery scripts and fail on errors

* Revert change to github ci workflow

* Test doc build with intentionally broken notebook

* Revert broken notebook

* Use MPLBACKEND environment variable

* Reorganize testing-related files

* Specify qt version for travis

* Don't test backend rcParam

* Fix dud test. (#2116)

* Modernize kdeplot and rugplot (#2104)

* Add expand_margins parameter to rugplot and make default

* Reorganize handling of mpl kwargs

* Handle deprecated rugplot params and begin specing out kdeplot

* Prototype out kdeplot using existing internal functions

* Mostly functional new implementation of univariate kdeplot

* Add new (and changed) kdeplot parameters: bw_method, bw_adjust, weights

* Prototype a number of new kdeplot features

* Reorganize KDE plotting a bit

* Tidy up the univariate plotting function with comments

* Handle missing hue levels and stacked cumulative plots

* Implement kde in log space

* Clean up existing tests

* Add test coverage for univariate kde plot

* Consider boolean x/y variables to be numeric

* Add explicit log scaling and reorganize outer kdeplot logic

* Add more kdeplot tests

* Compat with pinned matplotlib and scipy versions

* Handle and test singleton input

* Add axis labels to core and use in kdeplot

* Make flat_data organization parameterizable

* Add provisional legend for kdeplot

* Implement soft deprecation of shade in kdeplot

* Allow positional x in kdeplot/rugplot

* Cleaning

* Add tests for new rugplot

* Rename scale_by_hue -> common_norm and cut_by_hue -> common_grid

* Input checking and TODO cleanup

* Make univariate fill default depend on hue_method

* Use fill= instead of shade= when using kdeplot internally

* Refactor kernel density estimation logic into its own class

* Add bivariate KDE computation

* Implement much of new bivariate kdeplot

* Sort out bivariate kdeplot color(mapping) and some other issues

* Add bivariate log scaling and handle some aspects of the old API

* Temporarily enable old approach to bivariate color map

* Reverse the gradient of the hue-mapped light_palette

* Deprecate shade_lowest in favor of thresh

* Mark old tests that aren't going to pass with new version

* Fix color= logic in kdeplot

* Add rugplot legend

* Add test coverage for bivariate kdeplot

* Pinned matplotlib compat

* Add reverse iteration through semantic subsets and clean up kdeplot

* Improve stack/fill computation and set sticky support edges for fill

* Disable density axis labels in jointgrid marginal axes

* Update kdeplot usage elsewhere in library

* Allow lable for bivariate kdeplot without hue

* Remove old code and tests

* Add parameter documentation and notes for kdeplot

* Check the inputs types to a bivariate kdeplot and error early

* Add bivariate kdeplot examples

* Add a matplotlib rc to the doc directory forcing bbox_inches=tight

* Add rugplot api docs

* Skip doctests on pinned dep build

* Fix link to matplotlib color docs

* Remove last remaining internal usage of shade

* Add release notes for new distribution plots

* Simplify common_norm logic

* Converge on multiple= parameter

* Use only fill_between for filled densities, and add more color handling

* Update references to matplotlib artists in kdeplot

* Remove separate fill_kws dictionary

* Allow None as clip value

* Add new gallery examples

* Update axisgrid tests

* Simplify kdeplot drawing and modify test for old matplotlib compat

* Fix small issues in docstrings

[ci skip]

* Add overwrought apporach to docstring standardization

* Allow used named .format arguments

* Don't fail on int input and mask (#2103)

Cast to float before filling with np.nan (fixes #2102)

* Boxenplot bug fixes, small features and style changes (#2086)

* Avoid drawing unnecessary outliers

* Remove deprecated lvplot

* refactor defaults and internal signatures

* Fix and improve boxenplots tests

* FIX: avoid generating an extra box (#2086)

* Draw a single box with the correct color

* Tweaked boxenplot style

A few changes to make it more consistent with boxplot:

* Outliers now use gray color instead of plot color.

* Boxes also have edge color of self.gray. The default style enforces
  patches edges to be white (#1468) and this made invisible boxes on
  white background. boxplot uses self.gray edges as well so this is
  consistent.

* Use butt capstyle for medians

* Add boxenplot tests

* Allow k to be a number

* autoscale after drawing boxenplot (#2085)

* Make last box have some color

* more tests

* improve tests coverage

* improve strip over boxen example

* improve boxenplot docstring

* use tukey method by default (#803)

* improve code style

* add 'full' option to k_depth

* restrict 'outlier_prop' to (0,1]

* Fix "trustworthy" method (#2118)

* Adds a new parameter to control alpha levels of "trustworthy"

* Fixes the formula to calculate number of boxes for "trustworthy"

* update release notes

* rename box_alpha to trust_alpha

* improve code style

* Store code examples in API docs using notebooks (#2123)

* Add new infrastructure for generating docs from notebooks

* Move rugplot examples into notebook

* More imporvements to new notebook processing infrastructure

* Add output stripping to doc notebook build

* Add script for auto-generating API doc notebooks

* Improve Makefile infra

* Convert kdeplot API docs to notebook

* Read notebook kernel from environment variable

* Add pandoc to GH doc build

* Consolidate workflow

* Add histplot function (#2125)

* Refactor the KDE plotting so the computation is easier to re-use

* Add univariate histogram computation

* Prototype out much of the innner histogram functionality

* Add log-scaling, unsegmented hist, and other features

* Add sticky edges

* Further flesh out segment/fill for histogram

* Improve default aesthetics

* Spec out public histplot function

* Add discrete mode in histplot

* Copy over some supporting code from kdeplot for the time being

* Add bivariate histogram computation

* Add tests for histogram computation

* Add some histplot tests

* Cover most of histplot with tests

* Code housekeeping

* Simplify default linewidth scaling and other changes

* Better, although still unsatisfying, default handling

* Add shrink parameter

* Further tweak default linewidth

* Fix parsing of function docstrings

* Increase allowed linewidth

* Add API docs and examples for histplot

* Pin more specific matplotlib version

* Fix histplot kde color

* Add example that uses histplot

* Adapt default binwidth to the orientation of the plot

* Fix example

* Convert internal use of distplot to histplot

* Udpdate axisgrid tests

* Update histplot alpha test

* PEP8

* Refactor axis units/scaling, allowing experimental support for category/datetime in distribution plots

* Add tests for new axis scale/unit interaction

* Bump minimal matplotlib to 2.2 for consistent category and datetime64 behavior

* Prefer dropna method once we have reduced columns of plot data

* Allow non-filled bar edges to be a bit thicker

* Add clean rules to doc notebook subeets

* Use penguins and planets in histplot docstring

* Make segement default depend on presence of hue semantic

* Fix awkward wording

* Add 'dodge' as a multple method in histplot

* Make three options for histplot appearance: bars, step, poly

* Remove vestgial utility function

* Introduce other elements earlier in histplot examples

* Add frequency as a histogram stat

* Fix test name

* Reorganize DistributionPlotter methods

* Modify implementation of discrete

* Add prototype of bivariate histogram

* Add external interface for bivariate histogram

* Fix test for discrete histogram

* Add test coverage for bivariate histogram

* Document bivariate histplot

* PEP8

* Standardize bivariate colormaps and colorbars between histplot and kdeplot

* Add example that uses bivariate histogram

* Change multiple regression example to use penguins

* Add release notes on histplot

* Add color to histplot signature

* Don't follow color cycle with datetime variable when drawing filled plot

* Fix hue test

* Tweak some docs and comments

* Revert test for unused default

* Default to discrete bins for categorical variables

* Work around #2135 to always use non-null data

* Clean up a couple of TODO comments

* Simplify example

* Fix default color in histplot with datetime variable (#2136)

* Fix default color in histplot with datetime variable

* Fix default color in histplot with datetime variable

* Improve support for datetime (and categorical) data in relational plots (#2138)

* Improve support for datetime (and categorical) data in relational plots

Fixes #2130

* Disable pandas unit conversion during testing

* Force matplotlib date converters in test fixture

* Clarified documentation of despine (#2140)

* clarified documentation of despine

* improved wording

* Add ecdfplot function (#2141)

* Add basic ecdfplot implementation

* Allow user to override drawstyle

* Add unit tests

* Add docstring content

* Add more docstring information and fix test

* Add complementary ECDF

* Add ecdfplot API examples

* Fix step plots with y data variable

* Housekeeping

* Fix error message

* Mention ecdfplot in release notes

* MNT: fix some failures with matplotlib=3.3.0rc1 (#2144)

* Avoid error on new matplotlib for equal aspect test

* Avoid palplot failure on mpl3.3

* Avoid error for unnamed groups

Mpl3.3 requires that removing tick labels for categorical
plots is done with empty labels rather than an empty list.
This is an issue with unnamed groups for categorical plots
(e.g. boxplot(x=vector)).

* Delete .mailmap

* TST: Increase testing speed by utilizing multiple cores (#2146)

* utilize multiple CPUs with pytest

* cache test datasets before testing

* avoid pulling qt for non-interactive tests

* cleanup qtagg mentions

* Dont add null columns in plot_data for unassigned semantics (#2148)

* Dont assign null columns in plot_data for unassigned semantics

* Fix comment wording

[ci skip]

* DOC: enable Sphinx rules for linking to GitHub issues, PRs and users (#2151)

* add sphinx-issues extension

* remove unnecessary mpl import

* add links to PRs

* Elaborate on how to build the docs

* Improve seaborn discoverability (#2160)

* update trove classifiers

* Explicitly install pyqt to allow qt5agg tests

Since not all matplotlib distributions specify pyqt as a dependency

* Remove magic number in example script (#2165)

* Fix typo (#2168)

* Improve matrix functions docstrings (#2188)

* fix matplotlib backends usage path

* add intersphinx links

* Better comply with numpydoc

* Use only stdlib in get_dataset_names (#2190)

* Use only stdlib in get_dataset_names

* Fix import for miscplot tests

* Don't test on matplotlib 3.3.1 to avoid scatter bug (#2197)

xref #2194, matplotlib/matplotlib#18254

* Add displot, a figure-level distribution function  (#2157)

* Initial pass at prototyping new approach to figure-level functions

* Very messy implementation of new figure-level distplot

* Mostly functional bivariate histogram distplot, with hacks

* Use utility function to share default parameters (good idea?)

* Simplify some operations, add more original distplot features

* Implement basic kind='kde' in new distplot

* Implement basic kind=ecdf in new distplot

* Implement backwards compat for ax

* Minor formatting changes

* Rename semantic_subsets -> iter_data

* Centralize log scale logic

* Minor changes to easy distplot API transition

* Remove vestigial code that subset columns of plot_data

* Fix semantic ordering bug

* Increased hackification of the interface between VectorPlotter and FacetGrid

* Handle histogram post-processing on each facet

* Better (but still partial) integration between distplot and FacetGrid

* More distplot deprecation/API change handling

* Get tests passing

* Avoid duplicate columns in the dataframe passed to FacetGrid

* Enable log scaling and custom color

* Attempt to ease more distplot transition w/r/t kde_kws

* Abandon plan to convert distplot, introduce displot instead

* Add FacetGrid parameters to displot signature

* Add stopgap to get proper FacetGrid legend kind of working

* Revert all distplot changes since v0.10.1

* Add deprecation notice to distplot

* Revert keyword change in existing distplot docs and tests

* Add minimal support for new-style API in distplot, for use in FacetGrid

* Fix small issues with kde color and facet parameters

* Address some TODOs

* Handle a missing-data problem in hue mapping

* Add categorical ordering for some diamonds fields

* Add displot docstring

* Change direction of distribution/axisgrid imports; fill in displot template

* Add API examples for displot

* Add basic infrastructure for testing displot against axes-level function

* Add displot vs kdeplot tests

* Add displot tests vs ecdfplot

* Add rug tests and silence warnings

* Test bivariate and faceted displot

* Add test to cover some new core functionality

* Test new utility function

* Update example gallery

* Improve faceted displot test

* Handle stack/fill/dodge properly in faceted displot

* Control range of bivariate histogram colormap with respect to axes-specific bins

* Add another displot gallery example

* Drop NA in bivariate histogram when determining bins

* Invert y axis with categorical variables

* Handle some TODOs in the code

* Move location of keyword arg dict copy

* Fix inverted categorical y axis on older matplotlibs

* Deal with some TODOs but add note about shared categorical axes

* Add new distributions tutorial

* Update release notes

* Handle legend kwarg in displot

* Unset sticky edges on (thresholded) 2D hist

* Run coverage checks across travis matrix; enhance coverage

* Make a few edits to the new doc README

* Fix and modernize aspects of relational plot docs (#2200)

* Fix relational colors test method

Fixes #2147

* Modernize relational doc inheritence

Fixes #2065, Fixes #2187

* Dedent relplot doc components

* Reorganize docs to emphasize distribution module

* Handle mpl33 deprecations (#2199)

Co-authored-by: Maoz Gelbart <13831112+MaozGelbart@users.noreply.github.com>

* Support wide data with categorical columns (#2202)

* Convert relational model API examples to use notebooks (#2201)

* Update scatterplot API docs to use notebook

* Convert lineplot API examples to notebook

* Convert relplot API examples to use notebook

* Improve notebook processing, don't remove html output

* Start improving lineplot API examples

* Improve (?) lineplot API examples

* Improve scatterplot API examples

* Hide import cells in distribution plot API examples

* Demo using FacetGrid in relplot docs

* Fix doc bugs

[ci skip]

* Always set private despine variable in PairGrid (#2203)

Fixes #2166

* Change dropna default to False in axisgrid.py (#2204)

* Change dropna default to False in axisgrid.py

* Update release notes

* Improve variable assignment feedback (#2205)

* Raise when semantics are set with wide-form data

* Improve error messages when assigning longform data

* Fix tests that trigger new errors

* Avoid kde when variance is almost 0 (#2206)

Fixes #2186

* Address various warnings raised within the test (#2208)

* Fix log warning in comp_data test (and fix comp_data too)

* Avoid numpy ragged array warning when checking flat data

* Adjust code that triggers ragged array error

* Address other ragged array warnings

* Set xticks/yticks before setting labels

* use scatterplot instead of plt.scatter (#2069)

Co-authored-by: Michael Waskom <mwaskom@users.noreply.github.com>

* FIX: allow un-sharing categories in catplot (#2196)

* add tests for 1702

* unify categories across facets only when required

* document count as allowed kind parameter

* Honor user order input

* remove lvplot remnants

* warn if different categories may share color

* update release notes

* don't warn if hue is provided

* fix failing jointplot example

* fix distplot example 6

* Scale `legend.title_fontsize` when scaling fonts (#2214)

* add legend.title_fontsize to tested keys

* scale also legend.title_fontsize

* update release notes

* Add hue as parameter in JointGrid and "hist" as a kind in jointplot (#2210)

* Add 'hist' as a kind in jointplot

* Accept thresh=None in kdeplot

* Add provisional hue support in JointGrid/jointplot

* Move plot equality assertions into _testing module

* Test JointGrid with hue

* Test new jointplot features

* Make jointplot(kind='kde') default to unfilled densities

* Dispatch tuple-ized bin parameters with histplot

* Accept hue mapping parameters and pass to joint/marginal functions if possible

* Use core input processing in JointGrid

* Remove distplot kwargs from the marginal_kws dict and warn about them

* Fix internal names for JointGrid variables

* Default to densities for jointplot margins, like in pairplot

* Do hue-conditional behavior correctly in wide-form mode

* Add marginal_ticks as parameter of jointplot/JointGrid

* Fix typo

* Convert jointplot/JointGrid API examples to notebooks and update with new features

* Adapt marginal ticks test to run on older matplotlibs

* Convert JointGrid/jointplot docstrings to use inherited descriptions

* Update distributions tutorial and fix tutorial index page

* Update JointGrid-related examples

* Try setting backend to Agg during doc build

* Debugging doc build failure

* Attempting to isolate doc failure

* Don't crash doc build on bad thumbnail

* Add marginal ticks example back to the repo

* Undebug ci workflow

* Update release notes

* Fix object-typed numeric hue/size input to relational plots (#2173)

* Test object-typed hue/size

* Soft-convert object-typed arrays

* Satisfy linter

* fix a typo

* Change culmen to bill in all examples using penguins (#2215)

Mirrors changes in the R penguins dataset, saves characters, and
it's easier to remember how to spell 'bill'

* Adjust swarmplot overlap warning and avoid in examples (#2216)

* Adjust swarmplot warning to 5% of points

* Adjust examples that trigger swarmplot warning

* Remove deprecaed JointGrid annotation code (#2217)

* Add user guide documentation on plotting functions and data structures (#2218)

* Add more informative error message for bad dataset name

* Add narrative docs on seaborn data structures

* Fix heatmap example to reflect short month names

* Language tweaks

* Add a tutorial chapter giving an overview to seaborn plotting functions

* Add a schematic figure of long-frm vs wide-form data

* Add new basic user guide chapters to tutorial homepage

* Remove figure-level/axes-level and data structure discussion from introduction

* Convert main scatterplot matrix example to penguins

* Fix typos

* Tweak gallery examples

* Set penguins sex to title case on load

* Tweak thumbnail

* Point to new docs in release notes

* Make note section highlighting lighter

* Use decreasing values for categorical size mapping (#2221)

Fixes #2122

* Use core axis labeling method in relational plots (#2222)

* Add a rich HTML representation of color palette objects (#2225)

* Add rich html_repr to color palette object

* Update palettes tutorial and notebook

* Reverse direction of default distributions sequential colormap (#2224)

* Reduce surprise about relational plot legends (#2229)

* Fix unknown palette error

* Select better brief ticks

Larger maximum number of ticks and no ticks outside the range of the data

* Add 'auto' legend mode in relational plots

* Use 'auto' when relational legend is 'True'

* Only use dummy-artist 'subtitles' with multiple semantic variables

* Add clarity about numeric semantic mapping in scatterplot/lineplot docstrings

* Update release notes

* Update relplot legend tests

* Update legend locator test

* Add utility function to make subtitles look more like titles

* Delint

* Old matplotlib compat

* Try testing on latest matplotlib

* Test legendd=True

* Don't try to set attributes on removed axes (#2233)

Fixes #2228

* Delegate hue in PairGrid to plotting functions (#2234)

* Add provisional support for delegating hue in PairGrid

* Use histplot on pairplot diagonal

* Update Pairgrid tests

* Return self from map_diag

* Improve test coverage

* Convert PairGrid docstring to notebook and update

* Fix test

* Improve support for legends and markers with new plots

* Make color/label injection optional

* Update markers test

* More flexibility in PairGrid

* Convert pairplot API examples to notebook

* Add public access to Grid legend object

* Fix iterative plot_bivariate and improve test coverage

* Don't cast diagonal data to array (fixes #1663)

* replace numpy aliases with builtin types (#2236)

* Add new palette functionality and new colormaps (#2237)

* Add flare and crest colormaps

* Fix internal link

* Tweak some examples to use new colormaps

* Add as_cmap option to color_palette

* Get color palette object through color_palette

* Fix typo

* Get cmap object in kdeplot from internal lookup

* Test new functionality

* Fix logic of _d colormaps and allow _r_d

* Change sep default to 1 in diverging palette

* Pre-release docs enhancements (#2239)

* Add colormap html repr to matplotlib colormaps in palette tutorial

* Organize v0.11 release notes by module

* More release note improvements

* Execute all notebooks with python 3.8 and latest libraries

* Fix regression in palettes image

* Add late-breaking pairgrid enhancements to release notes

* Tweak gallery thumbnails

* Mention new colormaps in release notes

* Cover new color palette functionality in the release notes

* Reorganize homepage thumbnails

* Rewrite color palettes tutorial

* Simplify notebook cleaning code

* Improve palette docstrings

* More color theory background in palette tutorial

* More color variation on homepage

* PMention new palette tutorial in release notes

* Don't copy docstring source files into built site

* Add release note category badges

* Improve grouped barplot example

* Improve links

* Convert and update FacetGrid docstring

* Update tutorials

* Tweaks

* More tweaks

* Add references to seaborn objects used in gallery scripts

* Add proper logos to docs (#2245)

* Add proper logos to docs

* Add logo to README

* Left-align logo

[ci skip]

* Fix discrete string-specified light/dark palettes (#2247)

* DOC: minor fixes (#2242)

* Fix broken link

* tweak

* prefer :doc: over :ref:

* fix broken link

* fix comma

* Better documentation of FacetGrid's access to underlying matplotlib objects (#2248)

* Document FacetGrid axes_dict
Correct axes_dict example

* Further clarify FacetGrid's public access to underlying matplotlib objects

Co-authored-by: Maoz Gelbart <13831112+MaozGelbart@users.noreply.github.com>

* Pre-release docs updates (#2250)

* Language tweaks in intro

* Add background back to cubehelix palette example

* Add an example of making a heatmap using a scatterplot

* Fix cropping fof function overview schematic

* Tweak violinplot example

* Add a new histogram example and tweak another one

* Reorganize example gallery

* Downsize images a bit

* Tweak some text in various notebooks

* Improve installation page

* Improvements and streamlining of the introduction page

* Add axis label kwargs in FacetGrid.set_axis_labels

* Tweaking a bit further

* Mention docs updates in the release notes

* Streamline color theory examples

* Tweak lineplot example colors

* Clarify long/wide data

* Tweak logo

* Remove whitebg svg logos

* Various tweaks

* Fix typo

* Add link to seaborn discourse channel

* Add set_theme() to replace set() (#2253)

* Add set_theme function and change set to an alias

* Add test

* Change set -> set_theme everywhere

* Update aesthetics tutorial

* Update API page and release notes

* Expose set_theme as public API

* Fix bivariate histogram color in displot (#2255)

* Fix bivariate histogram color in displot

* Fix univariate kdeplot color in displot

* Convert coor attribute to rgba in artist tetsts

* Improve PairGrid tight_layout (#2256)

- Track the layout_pad parameter and use whenever tight_layout is called
- Call tight_layout at the end of pairplot

* Small formatting fixes in release notes

* Fix tutorial links in displot docstring

* Add new Zenodo DOIs

* Update internal version to 0.12.0.dev0

* Add links to archived versions of docs

* Pass `col_order` and `row_order` to FacetGrid in displot (#2262)

Co-authored-by: badge <mbadger@hudsonenergy.co.uk>

* Fix PairGrid with non-square grid and non-marginal diagonal axes (#2270)

* Fix PairGrid with non-square grid and non-marginal diagonal axes

Fixes #2260

* Add #2262 to release notes

* TST: fix colors and paths comparison in relational tests (#2281)

* test correct collection

* use matplotlib's same_color

* compare paths arrays lengths

* Fix: use linewidth when plotting boxes and medians (#2287)

* throw a meaningful error message in lmplot in case  kwarg is missing (#2302)

* Fix: do not annotate clustermap w/ annot=False (#2323)

Co-authored-by: criddell <criddell@ucdvais.edu>

* Fix `adjust_subtitles` when `legend_out=False`. (#2304)

* Test adjust_subtitles and legend_out interactions

* Fix adjust_subtitles when legend_out is False

* Remove redundant smoke tests

* Force doc CI to use Python 3.8 (#2335)

Relevant matplotlib issue https://github.com/matplotlib/matplotlib/issues/18718

* Error if row/col colors are indexed but data isn't (#2313)

* Test pandas row/col colors against nonindexed data

* Error if col/row colors are pandas but data isn't

* Improve matrix docstrings

* Reformat code block

* Use numpy array directly

* Format single backticks as literal code block

* Fix jointplot reference syntax in distributions tutorial. (#2359)

* Fix jointplot reference syntax in distributions tutorial.

* Fix rST syntax for hue (add space around ``code``).

* better checks for `sharey` and `sharex` in `axesgrid.py` (#2347)

* bugfix issue 2346

* fix

* MAINT: Drop nose and test on python==3.9 (#2328)

* MAINT: Migrate nose to pytest

* MAINT: Migrate nose to pytest

* MAINT: Migrate nose to pytest

* MAINT: Migrate nose to pytest

* MAINT: Migrate nose to pytest

* MAINT: Migrate nose to pytest

* Modernize some tests

* MAINT: Migrate nose to pytest

* Drop nose dependency

* Improve skip parameter name

* Test on python3.9

* Declare python==3.9 support

* TST: FIX: Consider array length in artist arrays comparison (#2363)

* Add artists length comparison

* Fix jointplot tests

* Fix displot tests

* Fix pairgrid (#2368)

* Add failing test for #2307

* Fix PairGrid hue mapping logic

Fixes #2307

* Fix faceted bivariate KDE normalization (#2378)

Fixes #2377

* Fix NA propagation in lineplot (#2273)

* Use nanpercentile in ci function

Fixes #2272

* Drop NA inside lineplot

Narrowly fixes #2272

But would like a broader solution here that also addresses #1552

* Add a test to catch NA propagation

* FIX: Infer categorical dtypes before boolean resolution (#2379)

* Add test for #2317

* Improve variable_type docstring

* Give precedence to categorical dtype inference

* Run tests on github actions (#2383)

* Assorted fixes for small problems (#2382)

* Fix color_palette docstring (fixes #2372)

* Disable jitter in dotplot example (fixes #2366)

* Raise early in jointplot when selected kind does not support hue (fixes #2326)

* Add weights to ecdfplot docstring (fixes #2348)

* Fix corner PairGrid without marginal diagonal (fixes #2354)

* Use math.isclose for zero variance check

See https://github.com/numpy/numpy/issues/10161

Fixes #2294

* Raise informative error when PairGrid has no rows/columns (Fixes #2311)

* Use same y axis scaling for diag_kind='hist' and diag_kind='auto' resolving to hist (fixes #2314)

* Handle list/array boolean check

* Update release notes

* Fix error with no marginal plots where density axis would be shared

* Slight rearrangement of PairGrid variable processing

* Add/restore functionality to long-form data processing (#2386)

* Add/restore functionality to long-form data processing

* Add tests for restored functionality

* Update release notes

* Require strings to access index fields

* Allow clustermap row/col colors to be categorical (#2389)

* Test for categorical row/col_colors input

* Allow categorical row/col_colors input

* Remove unreachable code

At this stage colors is not a pandas object

* Remove unused variables

* Reduce usage of global matplotlib state in axisgrid objects (#2388)

* Reduce usage of global matplotlib state in axisgrid objects

* Improve test coverage and legac compat in JointGrid

* Update release notes

* Always cast func.__module__ to str for safety

* Docs tidying for v0.11.1 release (#2393)

* Update doc dependencies

* Suppress function signatures on main API page

* Add conf params for compatability with newer doc theme

* Fix typos and formatting

* Prepare release notes for release

* Simplify CI build matrix

* Fix PF reference in release notes

* Fix API page sphinx

* Try building docs in parallel

* Fix API docs sphinx

* Reduce doc CI parallelization (#2394)

Can't parallelize over notebooks/html steps without breaking things

* Add v0.11.1 Zenodo badge

* Corrects typo in the diverging palette doc sub-section title (#2397)

* Corrects typo in the doc.

* Fixes the length of the underline

* Raise minimal supported Python to 3.7 and bump requirements (#2396)

* Raise minimal officially supported Python to 3.7

Following NEP29 and upstream libraries

* Make minor bumps to minimally supported library dependencies

Otherwise I couldn't get the pinned libraries installed on Python 3.7

* Change pip requirements style in CI

* Remove code that special-cases now unsupported scipy

* Fix KDE weights test

* Adapt test that fails on pinned matplotlib

* Remove compatability for no-longer-supported dependency versions

* Update release notes

* Make scipy an optional dependency (#2398)

* Vendor reduced version of scipy's KDE, adapt existing KDE code

* Adapt violinplot and stripplot to not require scipy

* Remove vendored kde docstring examples

* Fix missing import

* Remove more unhelpful doctests

* Note that cumulative kdeplot requres scipy

* Make scipy optional in matrix module

* Replace scipy iqr calls and adapt old distplot code

* Standardize flag for scipy availability

* Define extra dependencies in setup file

* Rework CI workflow for new dependency strategy

* Pass extras_require to setuptools

* Remove previously deprecated utility functions

* Remove scipy from categorical tests

* Remove scipy from regression module

* Remove scipy from categorical

* Remove scipy from distribution tests

* Protect scipy-using code in matrix tests

* Remove scipy from distributions tests (again)

* Fix docs about scipy requirements

* Update installing docs

* Update release notes

* Cover some missing-scipy-triggered errors in tests

* Update README and Remove requirements file

* Use modern canonical way of drawing the figure (#2399)

Closes #2343

* Add a note about getting offline docs access through the website repo

* Revert change to forced draw command (#2408)

The change in #2399 inadvertantly broke seaborn on the macosx mpl
backend.

See https://github.com/matplotlib/matplotlib/issues/19197

This PR reverts that change until the issue can be sorted out.

* Increase errorbar flexibility (#2407)

* Add EstimateAggregator and related functions

* Add tests for EstimateAggregator object

* Rework lineplot to use new aggregator object

* Test warning/redirection of old ci= arg

* Update errorbar param in lineplot docs and tutorial

* Add errorbar param to lineplot docstring

* Remove now-unused lineplot-specific aggregation method

* Add release notes stub

* Add text for tutorial chapter on error bars

* Fix lineplot on log scaled axis

* Let log_scaled default to False for unattached plotters

* Handle named functions and nans better in bootstrap function

* Generalize ci deprecation and increase docstring salience

* Simplify code

* Refactor tests and bump minimal pandas (#2412)

* Move long-form variable assignment tests to core test class

* Lift minimum pandas to 0.24

* Modernize some pandas type conversions

* Update .values -> .to_numpy() in tests

* Improve NA robustness in VectorPlotter.comp_data (#2417)

* Improve NA robustness in VectorPlotter.comp_data

* Adjust datetime test to account for archaic matplotlib limitation

* Update release notes

* Abstract logic of forcing figure draw with matplotlib backcompat (#2426)

See https://github.com/matplotlib/matplotlib/issues/19197 for context
Fixes #2343

* boxplot whis keyword docstring clarification (#2427)

* whis keyword docstring change

* Tweak language

Co-authored-by: Michael Waskom <mwaskom@users.noreply.github.com>

* Restrict comparison values for variable type strings (#2436)

This should avoid subtle bugs that could crop up when comparing against
the wrong form (e.g. "category" instead of "categorical").

There might be a built-in way to do this, but I couldn't find it...

* support Float64Dtype in boxenplot, related to #2434 (#2435)

* Fix typo (#2431)

* Modernize categorical plotting and refactor stripplot (#2413)

* Proof of principle refactored stripplot passing all tests

* Improve handling of categorical dates

* Improve automatic categorical orientation with dates

* Add more continuous datetime variable to long_df fixture

* Begin updating stripplot tests

* Update more stripplot tests

* Add test for single strip, with hue

* Fix infer_orient argcheck

* Add tests for flat and wide data in stripplot

* Refactor hue backcompat into a plotter class method, make optional

* Enable new default coloring rules in stripplot

* Update catplot to use new stripplot function

* Update assert_plots_equal to test all collections

* Clean up some comments

* Remove old stripplot code

* Fix typo

* Add explicit categorical order to VectorPlotter._attach

* Modify the implementation of categorical data handling to permit unshared facets

* Improve integration of axis converters with unshared facet grids

* Fix ordering by category dtype

* Fix catplot point sizes

* Add (un)fixed_scale

* Fix plot equality assertion

* Disable tests that hit matplotlib bug due to incomplete implemenation

* Improve test coverage

* Move forced/ordered categorical scaling logic to core

* Add core-level tets for scale method(s)

* Reduce use of special attributes, add formatter and hue_norm

* Update stripplot API examples

* Re-enable kwarg deprecation warning

* Fix log scaled stripplot

* Fixed log-scaled categorical axis

* Don't jitter single strips

* Improve swarmplot algorithm (#2443)

* WIP making swarmplot dynamically update the swarm

* Move beeswarm algorithm into distinct class

* Remove old swarm algorithm methods

* Update beeswarm algorithm to use pointwise sizes

* Force figure draw in swarmplot tests to activate swarm algorithm

* Use exact original value axis data

* Update swarmplot tests and release notes

* Fix tets

* Refactor swarmplot (#2447)

* Refactor swarmplot to match new stripplot (copying too much code)

* Refactor some shared components of swarm and strip plot

* Add dropna logic to iter_data

* Don't try to swarm empty collection

* Fix rst syntax

* Improve droopna logic and copy dataframe to avoid warnings

* Fix bug with jitter on empty category

* Remove original swarmplot code

* Transition catplot with kind='swarm' to new code

* Add more swarmplot tests

* Fix small test issues

* Mark a puzzling pinned test failure as xfail

* Delay log scale query in beeswarm until draw time

* Fix single point jitter

* Added control over the swarmplot warning with warn_thresh

* Update datalim and force autoscale at draw-time

* Update swarmplot API examples

* Refactor common parts of strip and swarm plot tests

* Always update datalim while swarming

* Move bug report text from website into contributing file

* Generalize getting default color from color cycle (#2449)

* Clean up auto-gray code

* Add initial versiono of default_color function

* Reenable swarmplot mandaatory kwarg warning deprecator

* Expand flexibility of supported scatter coloring kwarg

* Change logic of scatter-based coloring to post-proccess mpl object

* Test default and specified colors

* Rework how shared strip/swarm tests work

* Test user-supplied color array with swarm/strip plot

* Address failures on pinned tests

* Use centralized default_color function in scatterplot

* Use default_color function in lineplot

* Use general default color function for kdeplot, rugplot, and ecdfplot

* Use default_color function in histplot

* Get default color after attaching axes

* Mark kdeplot datetime autoscale test as xfail due to matplotlib bug

* Fix logic of color tests

* Workaround empty fill_between datetime autoscale bug

Fixes #2133 on newer matplotlibs

* More backcompat and edge casing

* Add color tests for distribution module

* Fix bar hist legend artists

* Mute color with hue warning for now

* Update README CI status badge to reflect GitHub Actions status

Closes #2453

* Handle deprecation of ci=None in lineplot (#2457)

Fixes #2441

* Fix rugplot with datetime data (#2458)

Fixes #2451

* Set alpha properly on unfilled hist/kde plots (#2460)

* Set alpha properly on unfilled hist/kde plots

Fixes #2450

* Fix typo in kdeplot docstring

* Generalize color comparison

* Add percent-based normalization in histplot (#2461)

* Add percent-based normalization in histplot

* Test bivariate normalization

* Fix multiple resolution when hue variable has no name (#2462)

* Fix multiple resolution when hue variable has no name

Fixes #2452

(cherry picked from commit 008f7e0e030681f8047c7d628e6bb3fc3d23e6ff)

* Remove unused kwarg

* Don't try to resolve multiples if there aren't any

* Simplify logic that ignored multiple when no hue was assigned

* Fix typo and remove outdated comment

* Fix faceted bivariate histogram normalization at displot (#2468)

Fixes #2465

* Update release notes

* Don't fail when docstrings have been stripped by -OO mode (#2473)

* Don't fail when docstrings have been stripped by -OO mode

Fixes #2470

* Fix comment

* Clarify language

* Fix typo

* Fix histplot shrink with non-discrete bins (#2477)

The code for shifting the shrunken bars assumed that discrete binning
was in effect. This is probably the only situation where shrinking
really makes sense, but there was no prevention or warning of getting
an innacurate result when using it with continuous bins.

Fixes #2476

* Update dates

* update matplotlib canonical... (#2482)

.. this will help with inter sphinx warnings.

* Don't pass a set to ListedColormap in clustermap (#2490)

* Don't pass a set object to ListedColormap

Addresses the issue in https://github.com/matplotlib/matplotlib/issues/19544

* Handle multiple LineCollection color kwargs

* Test side colors size homogeneity test

* Fix log scaling in distribution plots (#2504)

* Improve log_scale parameter documentation

Partly addresses #2454

* Fix log-scaled ecdf plots (fixes #2502)

* Fix log-scaled rug plot

* Fix histplot auto line width with log scale or categorical y axis (#2522)

* Fix histplot auto linewidth on log scaled axis

Fixes #2513

* Fix auto linewidth for categorical histograms on the y axis

Fixes #2523

* Add JOSS paper to docs/README (#2546)

* Update docs/readme with links to joss paper

* Remove Zenodo DOIs

* Mention JOSS paper in v0.12 release notes

* DOC: Clarify how to derive dodge parameter value for aligning pointplot in stripplot (#2548)

* DOC: clarify how to derive value for dodge param

* DOC: fix typo develpoment -> development

* DOC: misc fixes. (#2558)

Typos, non-existing parameters, and the fact that space before colon in
parameters is necessary for numpydoc to correctly parse the name and
type

* Reduce redundant computation in distplot linewidth (#2559)

Co-authored-by: Michael Waskom <mwaskom@nyu.edu>
Co-authored-by: Michael Waskom <mwaskom@users.noreply.github.com>
Co-authored-by: Jan Pipek <jan.pipek@gmail.com>
Co-authored-by: Todd <toddrme2178@gmail.com>
Co-authored-by: Christopher Whelan <topherwhelan@gmail.com>
Co-authored-by: Maoz Gelbart <13831112+MaozGelbart@users.noreply.github.com>
Co-authored-by: Iqrar Agalosi Nureyza <misteriqrar@gmail.com>
Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
Co-authored-by: bennguvaye <bennguvaye@users.noreply.github.com>
Co-authored-by: Ivan Gonzalez <scratchmex@gmail.com>
Co-authored-by: Lukas <36054362+lukasberbuer@users.noreply.github.com>
Co-authored-by: danyal-s <danyal-s@users.noreply.github.com>
Co-authored-by: Paul Rougieux <paul.rougieux@gmail.com>
Co-authored-by: Roman Werpachowski <61159095+romanwerpachowski@users.noreply.github.com>
Co-authored-by: Emilio Dorigatti <emilio.dorigatti@gmail.com>
Co-authored-by: Daniel Bauer <danijoo@users.noreply.github.com>
Co-authored-by: Tomas Ojea <tomasojea0@gmail.com>
Co-authored-by: Matthew Badger <badger.matthew@gmail.com>
Co-authored-by: badge <mbadger@hudsonenergy.co.uk>
Co-authored-by: Clément Robert <cr52@protonmail.com>
Co-authored-by: Cameron Riddell <31414128+CRiddler@users.noreply.github.com>
Co-authored-by: criddell <criddell@ucdvais.edu>
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
Co-authored-by: Aaron Spring <aaronspring@users.noreply.github.com>
Co-authored-by: Robin Scheibler <fakufaku@gmail.com>
Co-authored-by: joooeey <lukas.schreiber@gmx.at>
Co-authored-by: André F. Rendeiro <afrendeiro@gmail.com>
Co-authored-by: Ondrej Zacha <ondrej.zacha@okra.ai>
Co-authored-by: Marçal Gabaldà <mgab@users.noreply.github.com>
Co-authored-by: Jody Klymak <jklymak@gmail.com>
Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: Isaac Virshup <ivirshup@gmail.com>

The ImportError: No module named matplotlib.pyplot occurs if you have not installed the Matplotlib library in Python and trying to run the script which has matplotlib related code. Another issue might be that you are not importing the matplotlib.pyplot properly in your Python code.

In this tutorial, let’s look at installing the matplotlib module correctly in different operating systems and solve No module named matplotlib.pyplot.  

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.

Matplotlib is not a built-in module (it doesn’t come with the default python installation) in Python, you need to install it explicitly using the pip installer and then use it.

If you looking at how to install pip or if you are getting an error installing pip checkout pip: command not found to resolve the issue.

Matplotlib releases are available as wheel packages for macOS, Windows and Linux on PyPI. Install it using pip:

Install Matplotlib in OSX/Linux 

The recommended way to install the matplotlib module is using pip or pip3 for Python3 if you have installed pip already.

Using Python 2

$ sudo pip install matplotlib

Using Python 3

$ sudo pip3 install matplotlib

Alternatively, if you have easy_install in your system, you can install matplotlib using the below command.

Using easy install

$ sudo easy_install -U matplotlib

For CentOs

$ yum install python-matplotlib

For Ubuntu

To install matplotlib module on Debian/Ubuntu :

$ sudo apt-get install python3-matplotlib

Install Matplotlib in Windows

In the case of windows, you can use pip or pip3 based on the Python version, you have to install the matplotlib module.

$ pip3 install matplotlib

If you have not added the pip to the environment variable path, you can run the below command in Python 3, which will install the matplotlib module. 

$ py -m pip install matplotlib

Install Matplotlib in Anaconda

Matplotlib is available both via the anaconda main channel and it can be installed using the following command.

$ conda install matplotlib

You can also install it via the conda-forge community channel by running the below command.

$ conda install -c conda-forge matplotlib

In case you have installed it properly but it still throws an error, then you need to check the import statement in your code.

In order to plot the charts properly, you need to import the matplotlib as shown below.

# importing the matplotlib 
import matplotlib.pyplot as plt
import seaborn as sns

# car sales data
total_sales = [3000, 2245, 1235, 5330, 4200]

location = ['Bangalore', 'Delhi', 'Chennai', 'Mumbai', 'Kolkatta']

# Seaborn color palette to plot pie chart
colors = sns.color_palette('pastel')

# create pie chart using matplotlib
plt.pie(total_sales, labels=location, colors=colors)
plt.show()

Avatar Of Srinivas Ramakrishna

Srinivas Ramakrishna is a Solution Architect and has 14+ Years of Experience in the Software Industry. He has published many articles on Medium, Hackernoon, dev.to and solved many problems in StackOverflow. He has core expertise in various technologies such as Microsoft .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS (MSSQL), React, Powershell, etc.

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

By checking this box, you confirm that you have read and are agreeing to our terms of use regarding the storage of the data submitted through this form.

The modulenotfounderror: no module named ‘matplotlib’ Jupyter error log occurs when the virtual environment cannot locate the module named matplotlib or its package. This instance causes several issues with your Jupyter Notebook project or application that affect the package manager and terminate other processes and functions.No Module Named Matplotlib Modulenotfounderror

Srinivas Ramakrishna is a Solution Architect and has 14+ Years of Experience in the Software Industry. He has published many articles on Medium, Hackernoon, dev.to and solved many problems in StackOverflow. He has core expertise in various technologies such as Microsoft .NET Core, Python, Node.JS, JavaScript, Cloud (Azure), RDBMS (MSSQL), React, Powershell, etc.

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

By checking this box, you confirm that you have read and are agreeing to our terms of use regarding the storage of the data submitted through this form.

The modulenotfounderror: no module named ‘matplotlib’ Jupyter error log occurs when the virtual environment cannot locate the module named matplotlib or its package. This instance causes several issues with your Jupyter Notebook project or application that affect the package manager and terminate other processes and functions.No Module Named Matplotlib Modulenotfounderror

In addition, you could experience the modulenotfounderror: no module named ‘matplotlib’ Windows warning when the current Python version does not comply with the requirements from the remote repository, so it cannot render the inputs. Still, this guide teaches how to fix the module named ‘matplotlib’ code exception using advanced debugging techniques and methods that prevent complications with the install matplotlib procedures.

Contents

  • Why Is the No Module Named ‘Matplotlib’ Code Exception Happening?
    • – Running Different Matplotlib Libraries in Python
    • – The Matplotlib Package Is Missing From the Document
  • Fix the No Module Named ‘Matplotlib’ Error Log: Full-Proof Solutions
    • – Correcting the Spec Windows File
    • – Check Your Matplotlib Version
  • Conclusion

Why Is the No Module Named ‘Matplotlib’ Code Exception Happening?

The modulenotfounderror no module named ‘matplotlib’ PyCharm code exception happens because sometimes the system cannot find the module named ‘matplotlib’ or its package. The inconsistency can happen even after the matplotlib installed message appears. In addition, the modulenotfounderror: no module named ‘matplotlib’ Ubuntu bug is inevitable with different versions.

For instance, although the application has several correct modules and elements, a single package named ‘matplotlib’ could compromise the entire project and display the modulenotfounderror no module named ‘matplotlib’ vscode bug. The system experiences the need for such a package when the install pip procedure fails.

As a result, the application indicates the broken inputs and terminates further operations, which could affect other code snippets and commands. Hence, we suggest recreating and demonstrating the modulenotfounderror: no module named ‘matplotlib’ Mac error log using standard elements before implementing the solutions for the module named issue.

However, other confusing instances throw the modulenotfounderror: no module named ‘matplotlib_inline’ mistake, affecting similar inputs. For example, different Python versions or libraries could compromise your programming experience and kill the named matplotlib, although this is atypical with modern programs and applications.

In addition, the modulenotfounderror no module named ‘matplotlib’ but installed message can happen when messing up the configurations in the global or remote IDE, blocking the virtual environment. Hence, we recommend scanning your code and troubleshooting the flawed code snippet before practicing this guide’s debugging techniques and solutions.

– Running Different Matplotlib Libraries in Python

The error log is guaranteed when launching different matplotlib libraries and packages in your Python project. Although this inconsistency does not occur when running the code in your local repository, it can pop up when introducing the remote machine. So, we will exemplify the commands and traceback calls to complete the first broken instance.No Module Named Matplotlib Code Exception

You can learn more about the failed libraries in the following example:

(speech-env) C:UsersDesktopappkivyspyzer-exedistspyzer>spyzer.exe

[INFO ] [Logger ] Record log in C:Users.kivylogskivy_23-11-14_39.txt

[INFO ] [Kivy ] v2.1.2

[INFO ] [Kivy ] Installed at “C:UsersDesktopappkivyspyzer-exedistspyzerkivy__init__.pyc”

[INFO ] [Python ] v3.9.2 (tags/v3.9.1:1e15y33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]

[INFO ] [Python ] Interpreter at “C:UsersDesktopappkivyspyzer-exedistspyzerspyzer.exe”

[INFO ] [Logger ] Purge log fired. Processing…

[INFO ] [Logger ] Purge finished!

[INFO ] [Factory ] 1255 symbols loaded

[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)

[INFO ] [Text ] Provider: sdl2

[INFO ] [AudioGstplayer] Using Gstreamer 1.18.5.2

[INFO ] [Audio ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored)

Lastly, let us exemplify the error log that indicates the flawed processes and stops the application, as shown in the following example:

Traceback (most recent call last):

File “kivylangparser.py”, line 817, in execute_directives

File “<frozen importlib._bootstrap>”, line 1675, in __import__

File “<frozen importlib._bootstrap>”, line 2459, in _gcd_import

File “<frozen importlib._bootstrap>”, line 6175, in _find_and_load

File “<frozen importlib._bootstrap>”, line 9175, in _find_and_load_unlocked

File “<frozen importlib._bootstrap>”, line 125, in _load_unlocked

File “<frozen importlib._bootstrap_external>”, line 557, in exec_module

File “<frozen importlib._bootstrap>”, line 158, in _call_with_frames_removed

File “C:UsersDesktopappkivyspyzer-exedistspyzeraudio_analysis

Although this is a common cause, other confusing instances and culprits exist.

– The Matplotlib Package Is Missing From the Document

Demonstrating the missing package from the main document is challenging, so we will provide the analysis output to clarify the problems. Therefore, we will first focus on the imported packages from the main configuration. Later, we will list the code exception calls that pinpoint the missing commands and functions. These inputs could resemble the commands in your document.

The following example provides the analysis information:

a = Analysis(

[‘C:\Users\Desktop\app\kivy\kivy-speech\main.py’],

Pathex = [],

Binaries = [],

datas = added_files,

hiddenimports = [],

hookspath = [],

hooksconfig = {},

runtime_hooks = [],

excludes = [],

win_no_prefer_redirects = False,

win_private_assemblies = False,

cipher = block_cipher,

noarchive = False,

)

pyz = PYZ(a.pure, a.zipped_data, cipher = block_cipher)

exe = EXE(

exclude_binaries = True,

name = ‘spyzer’,

debug = False,

bootloader_ignore_signals = False,

strip = False,

upx = True,

console = True,

disable_windowed_traceback = False,

argv_emulation = False,

target_arch = None,

codesign_identity = None,

entitlements_file = None,

)

This code snippet is only complete after listing the error log confirming the flaws and inconsistencies, as explained in the following example:

Traceback (most recent call last):

File “C:Program FilesOdoo 14.0e.20210518serverodoobasemodelsir_http.py”, line 444, in _dispatch

result = request.dispatch()

File “C:Program FilesOdoo 14.0e.20210518serverhttp.py”, line 214, in dispatch

result = self._call_function (**self.params)

File “C:Program FilesOdoo 14.0e.20210518serverhttp.py”, line 145, in _call_function

return checked_call (self.db, *args, **kwargs)

File “C:Program FilesOdoo 14.0e.20210518serverservicemodel.py”, line 22, in wrapper

return f (dbname, *args, **kwargs)

File “C:Program FilesOdoo 14.0e.20210518serverhttp.py”, line 981, in checked_call

result = self.endpoint (*a, **kw)

File “C:Program FilesOdoo 14.0e.20210518serverhttp.py”, line 9124 in __call__

return self.method (*args, **kw)

Nevertheless, after implementing this guide’s debugging techniques and solutions, repairing this error log and its properties is straightforward.

Fix the No Module Named ‘Matplotlib’ Error Log: Full-Proof Solutions

You can fix the no module named matplotlib error log by installing or providing the missing package for the main document. In addition, we suggest correcting the spec Windows file to fit the project’s needs and requirements. Both debugging methods require isolating the incorrect commands.

Alternatively, you can repair your broken project by checking the matplotlib version to ensure it suits the Python program. Nevertheless, practice this technique only after implementing the primary debugging methods. Hence, this section teaches you how to install and provide the missing package for the main document. Finally, you will clarify the path and reenable the virtual environment.

We explained the technique in the following code snippet:

# in a virtual environment or launching Python 2

pip install matplotlib

# for python 3 (could also be pip3.15 depending on your version)

pip3 install matplotlib

# if you get permissions error

sudo pip3 install matplotlib

pip install matplotlib –user

# if you don’t have pip in your PATH environment property

python -m pip install matplotlib

# for python 3 (could also be pip3.15 depending on your version)

python3 -m pip install matplotlib

# using py alias (Windows)

py -m pip install matplotlib

# alternative for Debian (Ubuntu)

sudo apt-get install python3-matplotlib

# alternative for Red Hat / CentOS

sudo yum install python3-matplotlib

# alternative for Fedora

sudo dnf install python3-matplotlib

# alternative for Arch Linux

sudo pacman -S python-matplotlib

# for Anaconda

conda install -c conda-forge matplotlib

# for Jupyter Notebook

!pip install matplotlib

We provided several comments to help you understand the code’s purpose.

– Correcting the Spec Windows File

The error log should disappear after correcting the spec Windows file that confuses the module. As a result, we will provide a simple code snippet with several commands that repair the document and clears the bug. Although you can paste the syntax to your document, changing the values is essential.No Module Named Matplotlib Code Exception

You can learn more about this approach in the following example:

from kivy_deps import sdl2, glew

block_cipher = None

app_name = ‘App Name Here’

win_icon = ‘../Images/my_icon.ico’

a = Analysis ([‘../main.py’],

pathex = [],

binaries = [],

datas = [(‘../*.kv’, ‘.’),

(‘../Images/*.png’, ‘./Images’)],

Hiddenimports = [‘win32timezone’],

Hookspath = [],

runtime_hooks = [],

excludes = [],

win_no_prefer_redirects = False,

win_private_assemblies = False,

cipher = block_cipher,

noarchive = False)

pyz = PYZ (a.pure, a.zipped_data,

cipher = block_cipher)

exe = EXE (pyz,

a.scripts,

[],

exclude_binaries = True,

name = app_name,

debug = False,

bootloader_ignore_signals = False,

strip = False,

upx = False,

console = False,

icon = win_icon)

coll = COLLECT (exe,

a.binaries,

a.zipfiles,

a.datas,

*[Tree (p)

for p in (sdl2.dep_bins + glew.dep_bins)],

strip = False,

upx = False,

name = app_name)

We had to set several true and false values to complete the procedure and correct the code snippet. Lastly, check the matplotlib version to ensure you use the correct one.

– Check Your Matplotlib Version

An interesting get-around method is checking the version to ensure it fits the Python program. This technique takes a minute and works for all operating systems, so it is better to do it than not. In addition, you will get additional information about other system configurations and properties.

The following code snippet exemplifies this procedure:

pip show matplotlib

Name: matplotlib

Version: 3.2.5

Summary: Python plotting package

Home-page: https://matplotlib.org

Author: Bill D. Hunter, Josh Droettboom

Author-email: matplotlib-users@python.org

License: PSFS

Location: /srv/notebook/lib/python3.7/site-packages

Requires: cycler, numpy, kiwisolver, python-dateutil, pyparsing

Required-by: seaborn, scikit-image

Note: you may need to relaunch the kernel to use updated packages

As you can tell, the first code line initiates the procedure that checks your version and provides additional information about your project.

Conclusion

The no module named ‘matplotlib’ code exception happens when the system cannot find the ‘matplotlib’ package. Still, read the following bullet list to remember this guide’s vital points:

  • The warning happens when the current Python version does not adhere to the needs of the remote repository
  • You can fix the no module named matplotlib error log by installing or providing the missing package for the main document
  • Checking your matplotlib version and credential provides essential information about your project

After implementing this guide’s debugging techniques and solutions, no errors or obstacles should stand in your way. Still, remember some code snippets require additional changes and code alterations.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

Понравилась статья? Поделить с друзьями:
  • Python ошибка отступа неожиданный отступ
  • Python ошибка импорта своего модуля
  • Python ошибка takes no arguments
  • Python ошибка nameerror name is not defined
  • Python ошибка math domain error