Code Monkey home page Code Monkey logo

plotly_express's Introduction

Plotly Express

Plotly Express is now part of Plotly.py version 4 and so the plotly_express module now just re-exports the contents of plotly.express

Installation

If you follow the plotly Getting Started instructions for installation, you will get access to plotly.express.

However, if you have existing code that imports from plotly_express explicitly and you don't wish to change it, you can still install the latest version, which just exposes plotly.express under the plotly_express namespace.

Via pip

Just running pip install plotly_express==0.4.1 in your terminal should do it!

Via conda

You'll have to install from the plotly channel with conda install -c plotly plotly_express==0.4.1

Getting Help

Please join our Community Forum or file a Github Issue if you've found a bug.

plotly_express's People

Contributors

emmanuelle avatar ismailuddin avatar jonmmease avatar kaizeng avatar kmader avatar nicolaskruchten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plotly_express's Issues

Zoom for Scatter_geo

it seems scatter_mapbox has zoom level to adjust. I can not find one for scatter_geo. I only see center that need lat and lon but that does not help in zooming. Is it possible to set zoom for scatter_geo?

Plotly_express in a function or if-else statement

Hi,
plotly_express works perfectly for me within one cell. Now, I'm trying to put it inside a function and/or plot different graphs depending on the user input. As such, I'm putting two different plot functions within an if-else statement. For example,

example 1:

def f (data):
px.bar (data)

f (data)

example 2:

ip = input("Please input a or b")

if ip == 'a':
px.bar (......)
else:
px.histogram (....)

However, nothing shows up. Is this normal? Is there a way to work around it?

Thanks so much.

Regards,
Ken Chen

TypeError on All Plots

When trying to create any plot, I receive the error: TypeError: super(type, obj): obj must be an instance or subtype of type. This occurs even when running the examples as below:

import plotly_express as px
gapminder = px.data.gapminder()
px.choropleth(gapminder, locations="iso_alpha", color="lifeExp", hover_name="country", animation_frame="year",
              color_continuous_scale=px.colors.sequential.Plasma, projection="natural earth")

Screen Shot 2019-03-21 at 09 13 08 EDT

Using plotly-express==0.1

Int columns starting at 0 conflict with dataframe index

How to reproduce :

import plotly_exopress as px

columns = ['sepal_length', 'sepal_width']
iris = px.data.iris()[columns]
px.scatter(iris, 'sepal_length', 'sepal_width')

image

# Changing colnames to int
iris.columns = [0, 1]
px.scatter(iris, 0, 1)

image

As you can see the index of the dataframe is taken as the x axis in the last case

No attribute 'TitleValidator'

AttributeError: module '_plotly_utils.basevalidators' has no attribute 'TitleValidator'

Code:
df = pd.DataFrame(np.random.randn(100, 2), columns=list('AC'))
px.scatter(df, x='A', y='C')

I upgraded plotly but received the same error

in scatter plot, the values of column 'datetime' are totally different from original data

hello :
When using code in jupyter notebook,
import plotly_express as px
px.scatter(datanew, x='datetime', y="vol",range_y=[0,200],hover_name='vol')
the values of column 'datetime' in figure is totally different datetime. all datetime values are earlier 8hour.

python version
'3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]'

datanew.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1904 entries, 0 to 1903
Data columns (total 10 columns):
datetime 1904 non-null datetime64[ns]
vol 1904 non-null int32

datanew['datetime']
0 2019-03-11 09:31:00
1 2019-03-11 09:32:00
.......
1902 2019-03-20 14:57:00
1903 2019-03-20 15:00:00
Name: datetime, Length: 1904, dtype: datetime64[ns]

in the Figure, all datetime values are earlier 8hour
such as:
2019-03-11 09:31:00 became 2019-03-11 01:31:00

how to deal with the issue, may be time zone issue?
thanks

Flickering colorbar in scatter_mapbox

Thanks for the incredible library! I'm having a slight issue when I create a scatter_matbox, color the points by a continuous numerical variable, and animate by a time variable. The plot looks great except when it's animated and the legend flashes as below:

flickering_plotly_express_legend

Here's the code to reproduce:

import pandas as pd
import plotly_express as px

df = pd.read_csv('https://raw.githubusercontent.com/WillKoehrsen/Data-Analysis/master/nyc_traffic_data/nyc_traffic_speed_routes_sample.csv', 
                 parse_dates=['time'])

px.set_mapbox_access_token(secrets['mapbox'])

px.scatter_mapbox(df.iloc[:10000], 
                  lat='latitude', lon='longitude', 
                  animation_frame='time', 
                  animation_group='id',
                 color='speed', title='NYC Traffic Speeds',
                 height=800, zoom=9)

This is a fairly minor issue but I was wondering if perhaps there is an simple fix. Thanks again!

Bivariate distribution dependency

Plotting bivariate distributions with scatter plot combined with box/violin plots throws dependency error.

ModuleNotFoundError: No module named 'patsy'

Environment: Windows 10
Statsmodels: 0.9.0
Scipy: 1.1.0
pandas: 0.24.2
Plotly: 3.7.1

Blank charts

Hello All,

I am using Jupyterlab and I have installed plotly_express and the jupyterlab/plotly-extension successfully. I also have installed pdoc3>=0.5.3 & nbconvert>=5.3.1. I tried running the plotly express walkthrough (gapminder data) and I am getting a blank screen when I run the code below? No errors or any output? Do I need to install anything else?

import plotly_express as px
gapminder = px.data.gapminder()
gapminder2007 = gapminder.query("year == 2007")

px.scatter(gapminder2007, x="gdpPercap", y="lifeExp")

Any help would be appreciated! Thanks.

Example doesn't seem to work - Uncaught ReferenceError

After the announcement, I had to try the new/cool thing - however, I can't seem to get the basic Iris scatter plot example to render. The console tells me it's the following:

Screen Shot 2019-03-20 at 4 00 22 PM

I am running in the jupyter/scipy-notebook docker container with a requirement for jupyter_express.

It seems like it sets/draws the window, but nothing is rendered - let me know if more information is needed.

Ridgeline Plot

Hi. It would be great if there was support for a Ridgeline plot since it's a bit tedious to implement it manually. This has been discussed for plotly before:

It could be introduced as px.ridgeline() or px.violin(ridgeline=True). The latter would be great if the same can be achieved for histograms or scatter plots in general.

For inspiration, you can also have a look at https://www.tensorflow.org/guide/tensorboard_histograms
Nice implementation detail from the link:

Also, you may note that the histogram slices are not always evenly spaced in step count or time. This is because TensorBoard uses reservoir sampling to keep a subset of all the histograms, to save on memory. Reservoir sampling guarantees that every sample has an equal likelihood of being included, but because it is a randomized algorithm, the samples chosen don't occur at even steps.

Another useful thing is the x-axis line across the image for a better comparison across the y axis. The highlight of the x and y axis label don't seem to work in the second link above.

Also note the fade in the color from the back to the front in Tensorboard. On the other hand, in this image from the discussion above https://discourse-cdn-sjc2.com/standard17/uploads/plot/original/2X/e/e671a5ab96b5d911449d4607d1d2c61eced81d35.png you can see that the coloring depends on the x position instead which also offers easy visual guidance. So support for coloring depending on the x or y value would be highly useful.

The y-spacing should ideally be a parameter.

Thanks to @nicolaskruchten for guiding me here.

I have problems when I use plotly_express

When I use plotly_express on Python 3.7 alone, when you call the above code, the image doesn't jump out automatically, and Python automatically closes.
Excuse me, can this module not be used alone? Need to install plotly?

module 'plotly.graph_objs' has no attribute 'Splom'?

I'm using data with a structure that is similar to the gapminder example, but get the following error:
module 'plotly.graph_objs' has no attribute 'Splom'. I get the same error if I try using the gapminder dataset.

auto-detect orientation

based on presence of both x/y or the fact that one of them is categorical and not the other

Add Geopandas support

Hi,

Thanks for your amazing work, many custom function can now been deprecated and lots of keystroke are saved. If I may have a feature request it would be to support geopandas API for the geo plots.

If you are not familiar with this library, it inherits pd.DataFrame and embedd a custom geometry column that stores the geo object (Points, Polygone, Line ...).
It would be great if the plots could be done based on the geometry automatically, without casting points, or specifing the that you want polygons...

Tell me if you want more details about this.

Not showing any figure

Hi I'm new to plotly_express and also plotly, please correct me if I missed anything. I followed the steps described walkthrough.ipynb, and run the following code snippet in a single python file but nothing happened, no figure and nothing generated.

import plotly_express as px
gapminder = px.data.gapminder()
gapminder2007 = gapminder.query("year == 2007")

px.scatter(gapminder2007, x="gdpPercap", y="lifeExp")

Do I need to plot the figure by using plot(fig) like in matplotlib?
Thanks!

Faceted heatmap's should share single colorbar

In this example...
screen shot 2019-01-03 at 8 15 05 am

each of the three heatmap traces is producing it's own colorbar with slightly different autorange extents, and they all overlap. I think instead we should only display a single colorbar, and we should manually compute the cmin cmax values across the full dataset so that the colors across the three facets are comparable.

DLL Load Fail when using Trendline

Hello,

Working on a Windows 10 machine. I installed plotly_express, nodejs, etc. via conda 4.6.8 (with python 3.7.5 base). The nodejs version I'm working with is 8.10.0 after running into trouble installing the jupyter extension for plotly with the most recent version of npm/nodejs and finding this as a solution.

Running into some trouble trying to use the trendline feature of plotly_express in jupyter lab. I'm not sure this is the right forum because it seems to be an issue with dependencies or perhaps my conda environment but I figured someone here might know better than I do. Here's the code that's causing the error:

px.scatter(tips, x='total_bill', y='tip', trendline="ols")

And here's the error I'm running into:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-e169d3a4b36f> in <module>
----> 1 px.scatter(tips, x='total_bill', y='tip', trendline="ols")

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_chart_types.py in scatter(data_frame, x, y, color, symbol, size, hover_name, text, facet_row, facet_col, error_x, error_x_minus, error_y, error_y_minus, animation_frame, animation_group, category_orders, labels, color_discrete_sequence, color_discrete_map, color_continuous_scale, color_continuous_midpoint, symbol_sequence, symbol_map, size_max, marginal_x, marginal_y, trendline, trendline_color_override, log_x, log_y, range_x, range_y, render_mode, title, template, width, height)
     57     In a scatter plot, each row of `data_frame` is represented by a symbol mark in 2D space.
     58     """
---> 59     return make_figure(args=locals(), constructor=go.Scatter)
     60 
     61 

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_core.py in make_figure(args, constructor, trace_patch, layout_patch)
    722                     mapping_labels[:],
    723                     sizeref,
--> 724                     color_range=color_range if frame_name not in frames else None,
    725                 )
    726             )

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_core.py in make_trace_kwargs(args, trace_spec, g, mapping_labels, sizeref, color_range)
    145             elif k == "trendline":
    146                 if v in ["ols", "lowess"] and args["x"] and args["y"] and len(g) > 1:
--> 147                     import statsmodels.api as sm
    148 
    149                     if v == "lowess":

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\api.py in <module>
      3 from . import tools
      4 from .tools.tools import add_constant, categorical
----> 5 from . import regression
      6 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      7 from .regression.recursive_ls import RecursiveLS

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\regression\__init__.py in <module>
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels import PytestTester
      4 test = PytestTester()
      5 

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\regression\linear_model.py in <module>
     38 import numpy as np
     39 from scipy.linalg import toeplitz
---> 40 from scipy import stats
     41 from scipy import optimize
     42 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\__init__.py in <module>
    365 from __future__ import division, print_function, absolute_import
    366 
--> 367 from .stats import *
    368 from .distributions import *
    369 from .morestats import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\stats.py in <module>
    171 from scipy._lib._util import _lazywhere
    172 import scipy.special as special
--> 173 from . import distributions
    174 from . import mstats_basic
    175 from ._stats_mstats_common import _find_repeats, linregress, theilslopes, siegelslopes

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\distributions.py in <module>
      8 from __future__ import division, print_function, absolute_import
      9 
---> 10 from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
     11                                     rv_frozen)
     12 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\_distn_infrastructure.py in <module>
     22 
     23 # for root finding for discrete distribution ppf, and max likelihood estimation
---> 24 from scipy import optimize
     25 
     26 # for functions of continuous distributions (e.g. moments, entropy, cdf)

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\__init__.py in <module>
    385 
    386 from .optimize import *
--> 387 from ._minimize import *
    388 from ._root import *
    389 from ._root_scalar import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_minimize.py in <module>
     28 from ._trustregion_krylov import _minimize_trust_krylov
     29 from ._trustregion_exact import _minimize_trustregion_exact
---> 30 from ._trustregion_constr import _minimize_trustregion_constr
     31 
     32 # constrained minimization

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py in <module>
      2 
      3 
----> 4 from .minimize_trustregion_constr import _minimize_trustregion_constr
      5 
      6 __all__ = ['_minimize_trustregion_constr']

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py in <module>
      2 import time
      3 import numpy as np
----> 4 from scipy.sparse.linalg import LinearOperator
      5 from .._differentiable_functions import VectorFunction
      6 from .._constraints import (

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\__init__.py in <module>
    115 from .dsolve import *
    116 from .interface import *
--> 117 from .eigen import *
    118 from .matfuncs import *
    119 from ._onenormest import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py in <module>
      9 from __future__ import division, print_function, absolute_import
     10 
---> 11 from .arpack import *
     12 from .lobpcg import *
     13 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py in <module>
     20 from __future__ import division, print_function, absolute_import
     21 
---> 22 from .arpack import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py in <module>
     43 __all__ = ['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence']
     44 
---> 45 from . import _arpack
     46 import numpy as np
     47 import warnings

ImportError: DLL load failed: The specified procedure could not be found.

I tried spinning up the conda environment in a cmd window and ran the same command. Everything works fine, so this must be something I'm missing in jupyter. The script I used to set up the conda environment is:

conda create --name plotly-express
activate plotly-express
conda install -c conda-forge nodejs=8.10.0
conda install jupyter ipykernel numpy scipy pandas
conda install -c plotly plotly_express
jupyter labextension install @jupyterlab/plotly-extension
python -m ipykernel install --user --name plotly-express --display-name "Python (plotly_express)"

Create Trending Animated Bar Charts

I was wondering if this could be an interesting feature to add. I think that once the data is tidy i.e. just top 10 countries per year the only difficult think is the animation from one year to the next.

data not included in the package

the pip package has no data included

in a clean sandbox env

root@59885929898a:~# ipython
Python 3.6.8 (default, Feb  6 2019, 03:44:09) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import plotly_express as px 
   ...:  
   ...: iris = px.data.iris()                                                                                              
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-b241c3b3a10d> in <module>
      1 import plotly_express as px
      2 
----> 3 iris = px.data.iris()

/usr/local/lib/python3.6/site-packages/plotly_express/data/__init__.py in iris()
     39        'species_id']`.
     40     """
---> 41     return _get_dataset("iris")
     42 
     43 

/usr/local/lib/python3.6/site-packages/plotly_express/data/__init__.py in _get_dataset(d)
     76     import os
     77 
---> 78     return pandas.read_csv(os.path.join(os.path.dirname(__file__), d + ".csv.gz"))

proposed solution

add this in manifest.in

recursive-include data/*.csv.gz

refer to this

title not centered

I experienced a different behaviour in title alignment in plotly and plotly_express inthe first case the title is centered while in the second case is aligned to the left. The code for centered title in plotly is here while if try with plotly_express as
newplot

import pandas as pd
import plotly_express as px
px.scatter(df, x="gdp_percap", y="life_exp", color="continent",
           range_x=[0,50_000], range_y=[0,90], hover_name="country",
           title='Life Expectancy v. Per Capita GDP, 2007')

newplot (2)

Add line to a bar graph

Hi,

I'm wondering whether I can add a line to a bar chart and display the value in a secondary y-axis (on the right). In other words, I'm trying to combine two plot types into the same plot. Thanks very much.

hover_extras

list of columns that just get added to the hover at the end if they're not already there, via customdata ?

x polymorphism for index and series type

This will be useful for time series data.
Instead of copy time index to a column:

df['time'] = df.index
px.line(df, x='time', y='value')

it will be more convenient that we can do this directly:

px.line(df, x=df.index, y='value')

Thank you for this great library!

plotly_express installs via pip but doesnot import

Hi,

I am using Python 3.6.8 in anaconda environment.

pip install plotly_express works.:

(py3) bash-3.2$ pip install plotly_express
Requirement already satisfied: plotly_express in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (0.1)
Requirement already satisfied: plotly>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (3.7.1)
Requirement already satisfied: scipy>=0.14 in ./Library/Python/3.6/lib/python/site-packages (from plotly_express) (1.1.0)
Requirement already satisfied: pandas>=0.20.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (0.21.0)
Requirement already satisfied: statsmodels>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly_express) (0.9.0)
Requirement already satisfied: retrying>=1.3.3 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (1.3.3)
Requirement already satisfied: pytz in ./Library/Python/3.6/lib/python/site-packages (from plotly>=3.6.0->plotly_express) (2018.5)
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (1.11.0)
Requirement already satisfied: nbformat>=4.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (2.21.0)
Requirement already satisfied: decorator>=4.0.6 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: numpy>=1.8.2 in ./Library/Python/3.6/lib/python/site-packages (from scipy>=0.14->plotly_express) (1.15.0)
Requirement already satisfied: python-dateutil>=2 in ./Library/Python/3.6/lib/python/site-packages (from pandas>=0.20.0->plotly_express) (2.7.3)
Requirement already satisfied: patsy in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from statsmodels>=0.9.0->plotly_express) (0.5.1)
Requirement already satisfied: traitlets>=4.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (4.3.2)
Requirement already satisfied: jupyter-core in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (4.4.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (3.0.1)
Requirement already satisfied: ipython-genutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nbformat>=4.2->plotly>=3.6.0->plotly_express) (0.2.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (2018.8.13)
Requirement already satisfied: idna<2.9,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from requests->plotly>=3.6.0->plotly_express) (3.0.4)
Requirement already satisfied: setuptools in ./Library/Python/3.6/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (40.0.0)
Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (19.1.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=3.6.0->plotly_express) (0.14.11)

BUT I cannot find the module when I do "import plotly_express":

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import plotly_express

ModuleNotFoundError: No module named 'plotly_express'

Color line_mapbox by continuous variable

Is there a way to color a line_mapbox plot by a continuous variable? It looks like when I specify the color for a line_mapbox as a continuous float column, the float is interpreted as a category:

import pandas as pd
import plotly_express as px

df = pd.read_csv('https://raw.githubusercontent.com/WillKoehrsen/Data-Analysis/master/nyc_traffic_data/nyc_traffic_speed_routes_sample.csv', 
                 parse_dates=['time'])

px.set_mapbox_access_token(secrets['mapbox'])

px.line_mapbox(df.iloc[:10000], 
                  lat='latitude', lon='longitude', 
                  animation_frame='time', line_group='id',
                  animation_group='id',
                 color='speed', title='NYC Traffic Speeds',
                 height=800, zoom=9)

line_mapbox_continuous_variable

One solution would be to create my own column mapping the speeds to colors and then use that to color the lines, but I would still run into the issue of showing a legend. Thanks for the great library!

draw median for all visible traces

This come to my mind after working on this question on SO. The given case has an answer in dash as long as I have a trace for all possible case. In this case there are just 3 possibilities, option A, option B and both. But if I have n traces it turns out there are 2^n-1 possibilities. So produce all the traces for the median could be tedious. Is there a possibility to add a similar feature? Just to be clear I'm looking for a possible way to contribute to this project.

Consider removing column name and = sign in legend

Hi again @nicolaskruchten,

Something that puzzled me about the color arg in the plot is that it includes the name of the column followed by an equal sign. Would you consider removing it and just let the value of the column in place? Here are a few reasons to support that point :

  • It is not displayed in plotly by default
  • It's redundant information when we see date= orcountry= it easy to infer by the value of the field
  • It takes some extra place, that is valuable, especially in the vertical orientation.

image

Also, for personal taste, I think equal sign does not play well outside equations and prefer : instead.

Happy to discuss with you about it. Maybe there is an option that can disable it, that I am not aware of.

Example doesn't seem to work - ReferenceError: require is not defined

Hi,

when I execute px.scatter(gapminder2007, x="gdpPercap", y="lifeExp") I got an error in browser and nothing is showed in jupyterlab, but place for graph is reserved:

ReferenceError: require is not defined[Learn More] lab line 270693 > scriptElement:1:1
(index):1
attachWidget panellayout.js:210
insertWidget panellayout.js:113
_insertOutput widget.js:335
onModelChanged widget.js:217
invokeSlot index.js:475
emit index.js:433
emit index.js:106
_onListChanged model.js:282
invokeSlot index.js:475
emit index.js:433
emit index.js:106
push observablelist.js:137
_add model.js:213
add model.js:139
_onIOPub widget.js:93
_handleIOPub future.js:212
InterpretGeneratorResume (index):1255
next (index):1210
fulfilled future.js:6

In the same notebook plotly works, for example:
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

plot([go.Scatter(x=[1, 2, 3], y=[3, 1, 6])])

OS: Linux Manjaro
Browser: Firefox 66.0.1 (64-bit)
plotly: 3.7.1
plotly_express: plotly_express.version doesn't work, I don't know how to check
jupyterlab: 0.35.4
jupyterlab/plotly-extension: I don't know how to check version, but I have just installed it today

Cannot plot violin/box plots in Jupyter Noteboook

Hi there,

Just started using plotly express and I'm loving the interactivity of it! It works perfectly for my scatter plots I've created so far, but unfortunately does not work for violin or box plots.

Here is my set up:
Anaconda Navigator 1.9.7
Jupyter Notebook 5.7.8
Python 3.7.3
Plotly 3.7.0
Plotly Express 0.1.5

The error is:
ValueError: Invalid property specified for object of type plotly.graph_objs.Violin: 'hovertemplate'

This even occurs when i try to replicate the example from https://www.plotly.express/ (see screenshot below)
tips = px.data.tips() px.violin(tips, y="tip", x="smoker", color="sex", box=True, points="all")

Thanks for the help!
Brian

image

Add confidence interval bootstrap plot

In seaborn, when we use sns.pointplot, it calculates the confidence interval using a simple bootstrap if there's multiple values for a given x, and it's very handy. I think it would be awesome if plotly express could do something like that in an easy manner. Currently I have to calculate individually and manually these confidence intervals to plot in plotly.

This is an example of a pointplot:
http://mitalbalar.com/img/output_29_0.png

Colab doesn't seem to work

I setup an environment in colab by pip install plotly_express and that seems to have worked but both line and line_3d report errors

px.line(demo_df, 
            x='left_dir_x', 
            y='left_dir_y', 
           animation_frame='index')

I get the error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/IPython/core/formatters.py in __call__(self, obj)
    913             method = get_real_method(obj, self.print_method)
    914             if method is not None:
--> 915                 method()
    916                 return True
    917 

/usr/local/lib/python3.6/dist-packages/plotly_express/_core.py in _ipython_display_(self)
     36             init_notebook_mode()
     37             ExpressFigure.offline_initialized = True
---> 38         iplot(self, show_link=False, auto_play=False)
     39 
     40 

TypeError: iplot() got an unexpected keyword argument 'auto_play'

line_3d reports ValueError: Invalid property specified for object of type plotly.graph_objs.Scatter3d: 'hovertemplate'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.