Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Python: maximum displayable points on chart

Hey guys!

 

I have created a scatter plot that has the date on the X-axis and various values on the Y-axis (Columns: maxCurrentCutter & maxCurrentNormal — see screenshot). Since I wanted a slicer for differentiation, I transformed the table into a Unipivot table. However, when I want to visualize this, only the data points from 2020 to 2022 are visible on the visual, not 2020-2024. I'll show you a screenshot with the original table (maxCurrentCutter & Normal as two separate columns) and one with the Unipivot table.

 

In the Unipivot table, there are naturally twice as many rows as in the original table (about 250K vs. 125K), and even when I filter the Unipivot visualization so that about 140K data points are again present, it works as usual. But the original Visual has also 250K values and there it works to show all the data.

 

Therefore, my question is: Is there a maximum number of displayable points in Python visuals, or why else are not all datasets displayed?

That doesn't make any sense to me 

 

--------------------------------------------------------------------------------------------

Unipivot-visualisation:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates

# Datetype of 'Date'
dataset['Date'] = pd.to_datetime(dataset['startDate'])

# Define colors based on the 'Attribute' column.
colors = np.where(dataset['Attribute'] == 'maxCurrentCutter', 'green', 'orange')  # 'green' is for cutter, 'orange' is for normal

#Plot
plt.scatter(dataset['Date'], dataset['Value'], s=10, c = colors)

plt.title('Max Thread Cut Current')
plt.xlabel('DateTime')
plt.ylabel('[Ampere]]')
plt.grid(True)

# vertical Grid
#plt.gca().xaxis.grid(False)
plt.xticks(rotation=30)
plt.tight_layout()
plt.legend(handles=[matplotlib.patches.Patch(color='green', label='maxCurrentCutter'),
                    matplotlib.patches.Patch(color='orange', label='maxCurrentNormal')],
           loc='upper left')

plt.show()

 

Original visual:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Datetype of 'Date'
dataset['Date'] = pd.to_datetime(dataset['startDate'])

# Plot  
plt.scatter(dataset['Date'], dataset['maxCurrentCutter'], color='green', s=10, label='maxCurrentCutter')
plt.scatter(dataset['Date'], dataset['maxCurrentNormal'], color='orange', s=10, label='maxCurrentNormal')


plt.title('Max Thread Cut Current')
plt.xlabel('Date')
plt.ylabel('[Ampere]]')
plt.grid(True)
# vertical Grid
#plt.gca().xaxis.grid(False)
plt.xticks(rotation=30)
plt.tight_layout()
plt.legend(loc='upper left')

plt.show()

 

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    This does not match what the official documentation says, my guess is that the Unipivot table has an increased amount of data and therefore only shows the first part of the data.

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    This does not match what the official documentation says, my guess is that the Unipivot table has an increased amount of data and therefore only shows the first part of the data.

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.