Scattergl not drawing line with np.inf but only when in pd.Dataframe
Đang mở
Chưa có ai nhận issue này.
bug
P2
- Ngôn ngữ chính
- Python
- Star
- 18.8k
- Fork
- 2.8k
- Merge trung bình
- 16 giờ 26 phút
- Pull request đã merge (30 ngày)
- 21
Mô tả
Hello,
I’m having a strange issue where a graph_objects Figure with Scatergl is not drawing anything if there is an np.inf in the series, but only if the data is coming from a Pandas Dataframe. The below code shows an example of the issue (See 3rd figure). This issue appears with 6.0.0 install in python.
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
import pandas as pd
# Create a DataFrame with np.inf in a column
df = pd.DataFrame({
'x': [0, 1, 2, 3, 4],
'y': [0, 1, 4, 9, np.inf],
})
# Create a line plot (Things are OK)
fig = px.line(data_frame=df, x='x', y='y', title='Looks OK')
fig.show()
# Create a line plot w/ Scatter (Things are OK)
fig = go.Figure()
fig.add_trace(go.Scatter(
x=df['x'],
y=df['y'],
mode='lines',
))
fig.update_layout(title=dict(text="Looks OK"),)
fig.show()
# Create a line plot w/ Scattergl (Nothing shown on figure...)
fig = go.Figure()
fig.add_trace(go.Scattergl(
x=df['x'],
y=df['y'],
mode='lines',
))
fig.update_layout(title=dict(text="Nothing displayed..."),)
fig.show()
# Create a line plot w/ Scattergl (This is ok.... to_list fixes something?)
fig = go.Figure()
fig.add_trace(go.Scattergl(
x=df['x'].to_list(),
y=df['y'].to_list(),
mode='lines',
))
fig.update_layout(title=dict(text="Looks OK"),)
fig.show()
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện Python được cung cấp với plotly 6.0.0 và so sánh các đầu vào của Scatter, Scattergl và các đầu vào được chuyển đổi thành danh sách. Issue được hoàn tất khi Scattergl render đường từ Pandas Series chứa np.inf một cách nhất quán với các ví dụ khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- pandas, python
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100