You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have used orca for the image export in the past. I wanted a pip friendly solution and orca being an executable made me go away from plotly.
That being said, thank you for Kaleido! It's great to see the direction plotly is going in with the static image export 😃
I am very excited to start using plotly again along with kaleido!
I am trying this simple script to create a contour plot and export it to SVG. Here is my python script
import csv
import time
from math import log
from pathlib import Path
import plotly.graph_objs as go
class EyeScanPlotter:
@staticmethod
def contour_filled_to_svg(x, y, scan_data):
x_axis_options = dict(
zeroline=False, nticks=len(x), tickmode="auto", title="UI", mirror=True
)
y_axis_options = dict(zeroline=False, title="Voltage (Codes)", mirror=True)
layout = go.Layout(xaxis=x_axis_options, yaxis=y_axis_options)
fig = go.Figure(layout=layout)
fig.add_contour(
x=x,
y=y,
z=scan_data,
contours=dict(showlines=False),
colorscale="Jet",
showscale=False,
)
start = time.perf_counter()
fig.write_image("contour_filled.jpg")
print(f"Total (Filled) - {time.perf_counter() - start}")
@staticmethod
def contour_lines_to_svg(x, y, scan_data):
x_axis_options = dict(
zeroline=False, nticks=len(x), tickmode="auto", title="UI", mirror=True
)
y_axis_options = dict(zeroline=False, title="Voltage (Codes)", mirror=True)
layout = go.Layout(xaxis=x_axis_options, yaxis=y_axis_options)
fig = go.Figure(layout=layout)
fig.add_contour(
x=x,
y=y,
z=scan_data,
contours=dict(coloring="lines"),
colorscale="Jet",
line=dict(width=1.5),
showscale=False,
)
start = time.perf_counter()
fig.write_image( "contour_lines.jpg")
print(f"Total (Lines) - {time.perf_counter() - start}")
@staticmethod
def bathtub_to_svg(self):
pass
class EyeScanImporter:
@staticmethod
def load_from_csv(file_path: Path = None):
if file_path is None:
file_path = Path( "vivado_eye_scan.csv")
def normalize_codes_to_ui(data, min_range, max_range):
min_element, max_element = min(data), max(data)
for index, value in enumerate(data):
data[index] = min_range + (
((value - min_element) * (max_range - min_range)) / (max_element - min_element)
)
x_axis, y_axis, scan_data = list(), list(), list()
with file_path.open("r") as csv_file:
csv_file_contents = csv.reader(csv_file)
for row in csv_file_contents:
if row[0] == "Horizontal Range":
split = row[1].split()
min_value_range, max_value_range = (float(split[0]), float(split[-2]))
elif row[0] == "Scan Start":
for index, row in enumerate(csv_file_contents):
if row[0] == "Scan End":
break
if not x_axis:
x_axis = [float(value) for value in row[1:]]
normalize_codes_to_ui(x_axis, min_value_range, max_value_range)
continue
y_axis.append(float(row[0]))
scan_data.append([log(float(value)) for value in row[1:]])
return x_axis, y_axis, scan_data
start = time.perf_counter()
x, y, scan_data = EyeScanImporter.load_from_csv()
print(f"CSV import - {time.perf_counter() - start}")
EyeScanPlotter.contour_lines_to_svg(x, y, scan_data)
EyeScanPlotter.contour_filled_to_svg(x, y, scan_data)
For some reason the very first write_image, irrespective of the file format, take 6-9s. Subsequent exports are fast!
Would there be any reason why this is the case?
Full disclosure - I had similar issue with orca, but that turned out to be because of the firewall and virus scan SW thats installed on my work laptop - plotly/orca#231
Since Kaleido doesn't use ports, I was wondering if this slowdown is expected?
I plan to try this on my personal system and something makes me feel its going to be the firewall/virus scan again 😞
I still wanted to reach out and get your take on this
Update
I tried it on my personal Mac, in a fresh venv with only plotly and kaleido and it still takes around ~3s for the first write.
The text was updated successfully, but these errors were encountered:
Like Orca, the Kaleido executable to launched as a subprocess the first time an image export operation is requested, but then it stays running to handle future image export requests. This is why the first export is slower.
The time to launch the initial process will very across operating systems and hardware configurations, but I would generally expect Kaleido to launch as fast, or a little faster, than Orca did. And I'd expect it to be a little faster than it takes to launch Chrome/Chromium on the same system.
Are you seeing it being slower than Orca in the same environment?
Oh, its faster than Orca launch time for sure! I just wanted to know if the initial launch time of Kaleido is expected.
And it makes sense now, why it takes some time for the first export. That answers my question. Thanks @jonmmease 😃
I have used orca for the image export in the past. I wanted a
pip
friendly solution and orca being an executable made me go away from plotly.That being said, thank you for Kaleido! It's great to see the direction plotly is going in with the static image export 😃
I am very excited to start using plotly again along with kaleido!
I am trying this simple script to create a contour plot and export it to SVG. Here is my python script
And here is the
vivado_eye_scan.csv
fileFor some reason the very first
write_image
, irrespective of the file format, take 6-9s. Subsequent exports are fast!Would there be any reason why this is the case?
Full disclosure - I had similar issue with orca, but that turned out to be because of the firewall and virus scan SW thats installed on my work laptop - plotly/orca#231
Since Kaleido doesn't use ports, I was wondering if this slowdown is expected?
I plan to try this on my personal system and something makes me feel its going to be the firewall/virus scan again 😞
I still wanted to reach out and get your take on this
Update
I tried it on my personal Mac, in a fresh venv with only plotly and kaleido and it still takes around ~3s for the first write.
The text was updated successfully, but these errors were encountered: