Hv plot works with jupyter but when I copy to pycharm nothing shows without error

hv plot works with jupyter but when I copy to pycharm nothing shows without error.

In fact I want to replicate this tutorial:

it works well in the Jupyter. but when I copy the code in pycharm it will debog the line :

traj_collection.hvplot(title=‘Trajectories by ship type’, c=‘ShipType’, column_to_color=shiptype_to_color, line_width=1)

without any error dut doesnt show anything.

PyCharm notebook support is extremely impoverished and until that changes I don’t think there’s anything we can do to change that.

Thank you for your response.
what kind of IDE do you suggest me to work with to avoid this?
I dont want to use jupyter as the IDEs like pycharm have the ability of tracing, …
is it a common issue between the users?

Thanks.

You could render your holoviews plot to bokeh and then use bokeh’s show function on it.
This opens a browser tab showing your plot.

hv.extension('bokeh')
from bokeh.plotting import show

show(hv.render(your_holoviews_plot))

You can find working solutions here:
https://stackoverflow.com/questions/57971107/how-do-i-get-my-interactive-holoviews-graph-to-display-in-visual-studio-without/

thank you.
I Copied your solution from the stackoverflow that you mentioned in my pycharm (not visual studio) and I got this error:

It is a permission error I guess.
do you know how to solve it?
your help would be appreciated.

Wooooow.
I could run it when I reopened my pycharm with “open as administrator”
Thanks.

I would recommend this over using bokeh’s show if you’re working with dynamic plots:

import panel as pn
pn.serve(your_holoviews_plot)

Thanks.
both strategies worked for me.
my data is not dynamic but I work with large dataset containing milions of points. when I want to render them it would take a lot of time. and when I want to zoom in, it takes a lot of time.
which solution do yo recommend?

I’d look into the datashader support: http://holoviews.org/user_guide/Large_Data.html

1 Like

As mentioned by philipp datashade is the way to go.
When using hvplot you can simple use setting datashade=True to visualize millions of datapoints.
Here’s a code example for a large data sample:

# import libraries
import numpy as np
import pandas as pd
import hvplot.pandas
import holoviews as hv
hv.extension('bokeh')

# create a large data sample
data = np.random.normal(size=[500000, 2])
df = pd.DataFrame(
    data=data,
    columns=['col1', 'col2'],
)

# use setting datashade=True for large data visualization
plot = df.hvplot.scatter(x='col1', y='col2', datashade=True)