question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot add smooth line

See original GitHub issue

I would like to add a smooth line through a scatter plot, so far I’m aiming at two solutions:

(ggplot(A_phsA, aes('timestamp', 'A_phsA'))
    + geom_point(color = 'blue')
    + xlab("2018 - 2019")
    + ylab("Phase current A [A]")
    + scale_x_datetime(breaks=date_breaks('1 month'), labels=date_format('%m %Y'))
    + geom_line(stat="smooth", method="loess", alpha=0.7)
    + theme(figure_size=(11, 6), axis_text_x=element_text(rotation=45))
)
(ggplot(A_phsA)
    + aes('timestamp', 'A_phsA') 
    + geom_point(color = 'blue')
    + xlab("2018 - 2019")
    + ylab("Phase current A [A]")
    + scale_x_datetime(breaks=date_breaks('1 month'), labels=date_format('%m %Y'))
    + geom_smooth(alpha = 0.1)
    + theme(figure_size=(11, 6), axis_text_x=element_text(rotation=45))
)

but none is working. What am I doing wrong?

plot

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
has2k1commented, Sep 24, 2019

@jtrakk , I was mistaken, this is not a bug. The issue is the date column is a string. It needs to be the correct type.

data = pd.DataFrame({
    'date': pd.to_datetime(['1990-01-01', '1995-01-01', '2000-01-01']),
    'num': [1, 2, 5]
})
0reactions
jtrakkcommented, Sep 24, 2019

I see. In that case it would be nice to have a helpful exception message instead of silent failure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

smooth line missing - Microsoft Community Hub
If you look at the Insert Chart dialog and select the "All Charts" tab, you'll only see smoothed lines in the xy (scatter)...
Read more >
How to add a smooth line using ggplot2 in a plot with 2 ...
I am trying to make a scatter plot with 2 different datasets and a smooth line of each scatter to compare them.
Read more >
Smooth Tool in Illustrator - eduCBA
With this smooth tool, the user can make pencil sketches and drawings look smoother and glossier without any rough edges. How to Use...
Read more >
How To Smooth Lines In Illustrator CC - YouTube
Learn how to smooth lines in Adobe Illustrator CC in this super quick and easy tutorial. ... Your browser can't play this video....
Read more >
Why can't I get smooth lines? - Affinity | Forum
I want my lines to be smooth, but I keep ending up with horribly choppy lines. My canvas is 1920x1080p 300 dpi. I'm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found