question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`mpl deprecation warning` for converting simple `plt.scatterplot` to `bokeh`

See original GitHub issue
import bokeh
print(bokeh.__version__)
#0.12.2

# Plot from Matplotlib

# Tools (Not sure how to add this when converting from `matplotlib` or `Seaborn`)
hover = HoverTool(
        tooltips=[
            ("index", "@index"),
            ("(x,y)", "(@t, $y)"),
            ("desc", "@desc"),
        ]
    )

# Data
DF_data = pd.DataFrame([a, np.sin(np.pi*a), np.cos(np.pi*a)], index=["t", "sine", "cosine"], columns=["t_%d"%_ for _ in range(100)]).T
DF_data["desc"] = ["info about this" for _ in DF_data.index]

# Matplotlib
fig, ax = plt.subplots(figsize=(15,5))
ax.scatter(data=DF_data, x="t", y="sine", s=np.linspace(0,100,100), alpha=0.5, color="green")
ax.scatter(data=DF_data, x="t", y="cosine", s=np.linspace(0,100,100)[::-1], alpha=0.5, color="teal")

# Convert to Bokeh
bokeh.io.show(bokeh.mpl.to_bokeh())

The error:

/Users/Mu/anaconda/lib/python3.5/site-packages/bokeh/core/compat/bokeh_renderer.py:257: UserWarning:

Path marker shapes currently not handled, defaulting to Circle

/Users/Mu/anaconda/lib/python3.5/site-packages/matplotlib/artist.py:221: MatplotlibDeprecationWarning:

This has been deprecated in mpl 1.5, please use the axes property. A removal date has not been set.

/Users/Mu/anaconda/lib/python3.5/site-packages/bokeh/core/compat/bokeh_renderer.py:290: UserWarning:

Path marker sizes support is limited and may not display as expected

The output plot: screen shot 2016-10-03 at 2 32 59 pm

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Oct 3, 2016

Scatter works best with “tidy” data frames, so if you had a “type” column that had values “sine” or “cosine” for each t and y, you could do: Scatter(df, x="t", y="y", color="type")

Edit: pd.melt can do this transformation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.melt.html

0reactions
bryevdvcommented, Oct 4, 2016

@jolespin yes if you need to control the alpha then currently you should definitely stick with bokeh.plotting. It would not be too difficult (I don’t think) to add support for an alpha setting on some charts, but it can’t be a high priority at the moment given all that there is to do. If you are interested in looking into it, I an point you in the right direction.

I should also mention that there are some improvements coming in 0.12.3 that make mapping colors and alphas directly to data columns much easier with bokeh.plotting. I don’t have time to elaborate this morning but you can check recent PRs, or await the release announcement.

I am going to close this issue, since the discussion has turned to support type questions. Those are more properly directed to the mailing list: https://groups.google.com/a/continuum.io/forum/?pli=1#!forum/bokeh

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adjust matplotlib marker size in Bokeh? - Stack Overflow
I am compelled to advise you that as of Bokeh 0.12.5 (to be released later this week), Bokeh's MPL compat support is being...
Read more >
Releases — Bokeh 2.4.0 Documentation
HSL is deprecated and will be removed in a future release. ... Use the layout.center_panel of a plot to access any layout-related capability....
Read more >
Matplotlib to bokeh conversion discards category labels #2277
I'm trying to get seaborn violin plots working in bokeh. I'm following this example . My category labels seem to get discarded on...
Read more >
[Example code]-Adjust matplotlib marker size in Bokeh?
I was looking at this matplotlib scatter plot example: ... Simple demo of a scatter plot. ... Bokeh's MPL compat support is being...
Read more >
Interactive Data Visualization in Python With Bokeh
Implementing selection behavior is as easy as adding a few specific keywords when declaring your glyphs. The next example will create a scatter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found