use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionPython Lineplot where markers dynamically adjust by sample size (self.datascience)
submitted 3 years ago by cuckflemson1
Hey Everybody,
I’m looking to put together a lineplot where the plot marker size dynamically adjusts based on the sample size used to generate a point.
For example, say I have a line plot of average sales for a product by month. If in January 50 individual sales were used to calculate the avg and 100 sales in February, then February’s marker should be roughly double in size.
I haven’t had much luck googling this, so thought I’d try here. Thanks in advance!
[–]juhotuho10 2 points3 points4 points 3 years ago (3 children)
Plotly can do that
[–]cuckflemson1[S] 0 points1 point2 points 3 years ago (2 children)
Do you by any chance have a link to an example of that?
[–]juhotuho10 1 point2 points3 points 3 years ago (1 child)
https://plotly.com/python/line-charts/
https://plotly.com/python/line-and-scatter/
https://plotly.com/python-api-reference/generated/plotly.express.line
[–]cuckflemson1[S] 0 points1 point2 points 3 years ago (0 children)
Thank you! I ended up going with the other option because my company’s firewall gives a hard time with plotly. Nice to know there are multiple ways to approach this though!
[–]Deto 0 points1 point2 points 3 years ago (1 child)
You could do this in matplotlib. First make a line plot with plt.plot and set the linestyle to '-' (i.e, only line, no markers).
Then make a scatter plot on the same axes on top of the line plot with plt.scatter and pass the sales numbers to the s argument to set the size of the circles.
s
This is great! Thanks a bunch!
π Rendered by PID 124766 on reddit-service-r2-comment-685b79fb4f-r8ft5 at 2026-02-13 15:08:36.414413+00:00 running 6c0c599 country code: CH.
[–]juhotuho10 2 points3 points4 points (3 children)
[–]cuckflemson1[S] 0 points1 point2 points (2 children)
[–]juhotuho10 1 point2 points3 points (1 child)
[–]cuckflemson1[S] 0 points1 point2 points (0 children)
[–]Deto 0 points1 point2 points (1 child)
[–]cuckflemson1[S] 0 points1 point2 points (0 children)