visualization

Fitting Variable Number of Lorentzian Peaks to a glob of data in text files

Fitting Variable Number of Lorentzian Peaks to a glob of data in text files Question: So I’ve gotten the code to work, but it’s extremely slow and doesn’t give the proper full width at half maxima. Is there something I can do to get the FWHM values and speed up the processing without losing post-processing …

Total answers: 1

Matplotlib – Line plot not appearing

Matplotlib – Line plot not appearing Question: I am trying to plot a chart with multiple plots like line, scatter etc., The line plot Im trying to plot is not showing up on the chart. I want a line plot like this: fig, ax = plt.subplots(figsize=(20, 6)) plt.plot(result, color=’red’) plt.show() I want this to show …

Total answers: 2

How to avoid graphing duplicate rows in Pandas .plot()

How to avoid graphing duplicate rows in Pandas .plot() Question: I have a Pandas DataFrame that looks like this with many entries for all 50 US states: State Name School District Schools Per District Alabama Alabama District 1 21 Alabama Alabama District 2 5 Alaska Alaska District 1 3 Alaska Alaska District 2 4 I …

Total answers: 1

How to adjust steps of y-axis

How to adjust steps of y-axis Question: I have a plot in which I have two y-axis. The y-axis on the left represent the bar chart and the y-axis on the left represent the two lines. The problem is that the left y-axis currently creates individual steps for the y-axis values, which results in additional …

Total answers: 1

How find the minimum point on the plotted line (xmin, ymin) add the minimum point?

How find the minimum point on the plotted line (xmin, ymin) add the minimum point? Question: i can’t find min. How to add minimum point? Please help How find the minimum point on the plotted line (xmin, ymin) add the minimum point ? import numpy as np import matplotlib.pyplot as plt x = np.linspace(-5, 5, …

Total answers: 1

Seaborn: cumulative sum and hue

Seaborn: cumulative sum and hue Question: I have the following dataframe in pandas: data = { ‘idx’: [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10], ‘hue_val’: ["A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","C","C","C","C","C","C","C","C","C","C",], ‘value’: np.random.rand(30), } df = pd.DataFrame(data) Now I want to have a line plot with the cumulative sum over the value by following the "idx" for each "hue_val". So in the end it would be …

Total answers: 2

Python multiple lines lineplot, unable to access correct data from dataframe

Python multiple lines lineplot, unable to access correct data from dataframe Question: I have a dataset with multiple columns. From these columns, I want to access YEAR and EVENT_TYPE. Year 1 1997 2 1997 3 1997 4 1997 … 1673110 2023 1673111 2023 1673112 2023 1673113 2023 1673114 2023 Event_type 1 Violence against civilians 2 …

Total answers: 1

Show legend with different colors for multiple axvspan

Show legend with different colors for multiple axvspan Question: How do I plot different colors in legend for different axvspans? I do not understand the behaviour of matplotlib: def plot_test_results(df, c, t_start, t_end): t_start = [datetime.strptime(t, ‘%Y-%m-%d’) for t in t_start] t_end = [datetime.strptime(t, ‘%Y-%m-%d’) for t in t_end] for t1, t2 in zip(t_start, t_end): …

Total answers: 1

Drawing a oval shape to represent a race track given data

Drawing a oval shape to represent a race track given data Question: So I have data with 100s of dictionaries which include both X & Y values. These data represents the coords from the start of the race to the finish. From this data, I have gotten the MaxX, MaxY, MinX, MinY to figure the …

Total answers: 1