Comments (8)
This looks like a duplicate of #154 ...
You cannot directly attach a CSV file here in the GitHub issue. Please upload it somewhere (in a GitHub repo, for instance) and share the link here. Or copy-paste the top of your dataframe.
from plotly.r.
Hi Marianne Corvellec,
Thanks for your response.
As had mentioned in 154, please close 154.
Please refer to file xfyFileData.csv given at https://github.com/cyruslentin/plotly.
With this csvs file, you will be able to run both the above mentioned codes easily.
As mentioned by you, have also tried
geom_point(aes(size=2, color="black")) in the plotly code. But results not good.
Regards -- Cyrus
from plotly.r.
Sorry wrong statement given above. Used the one given below
geom_point(aes(x=ShortMonth, y=CurrentMonth, group=FiscalYear, size=2, color="black")) +
No difference was seen in the output,
BTW, if the same change is made in the ggplot code then the black dots change to pink and an extra label is seen. Wonder why?
Any help will be appreciated.
from plotly.r.
Hello,
I think the error arises because ggplotly()
is trying to merge the geom_line()
and the geom_point()
layers into one trace. I'll investigate and get back to you.
Thanks,
Marianne
from plotly.r.
Hello @cyruslentin !
On using color
(colour
) as an aesthetic of geom_point
, as in
geom_point(aes(x=ShortMonth, y=CurrentMonth, group=FiscalYear, size=2, color="black"))
BTW, if the same change is made in the ggplot code then the black dots change to pink and an
extra label is seen. Wonder why?
This is a pure "ggplot2" question, which is not the scope of this project, so I'll refer you to the official "ggplot2" docs http://docs.ggplot2.org/0.9.3.1/geom_point.html (see second example) and http://docs.ggplot2.org/current/aes_group_order.html (see second example also).
It does not make sense to add a category of data that you would call "black". It gets represented in pink just because that's one of the levels in the default colour scale.
from plotly.r.
Hi again @cyruslentin
I suggest using the following code:
xfyDataPlot <- ggplot(data=fileData, aes(x=ShortMonth, y=CurrentMonth,
label=CurrentMonth,
group=FiscalYear)) +
geom_line(aes(color=FiscalYear), size=1.1) +
geom_point(size=2, color="black") +
xlab("Month") + ylab("IIP Data")
This converts well into plotly:
It's almost exactly like your initial version, but I have moved the color
aesthetic under geom_line()
, which is where it belongs/applies only. If you leave the color
aesthetic under ggplot()
, it carries over to the geom_point
layer, just like it does to the geom_point
one. But this is not what you want or what you mean, since you want all your points to be black, you don't want them to reflect distinctions in the data.
The only imperfection you get (https://plot.ly/~marianne2/566/iip-data-vs-month/) is that you are missing the legend title somehow... Will open a specific issue for this.
Thanks for reporting!
from plotly.r.
HI Marianne,
Thanks for all your efforts & also a quick revert.
Further thanks for the detailed explanation on the "color (colour) as an aesthetic of geom_point" as well as cracking the issue. Legend Title not appearing - I guess one can live with that :)
Have incorporated the same in the code and checked; this works as is discussed.
Please treat this issue as closed. Though if there is any development on Legend Title please do let me know.
Regards -- Cyrus
from plotly.r.
You're welcome, Cyrus.
Great, please refer to #159 for any update on the missing legend title issue.
from plotly.r.
Related Issues (20)
- Plots not showing in Rstudio Viewer HOT 6
- Categorical ggplotly legend no longer interpreted as categorical when two aesthetics are used HOT 1
- Change default plot height from 450px to something user-selected.
- Missing legend for mesh3d unless surface is added
- ggplotly is not working properly with scale_fill_binned
- `ggplotly()` gives subscript error with latest ggplot2
- Update plotly.js? HOT 1
- Incomplete documentation for `plot_ly`
- eom_GeomArcBar() has yet to be implemented in plotly
- plotly cannot handle Inf or -Inf when plotting
- implement geom_GeomStrippedCols() to be used with plotly
- Implement geom_rain and stat_halfeye into ggplotly
- labels in scale_color_manual() are ignored
- Plot_ly sunburst restyle event puts sunburst in weird state
- Hover incorrect when supplying color as argument in add_trace
- Unable to see x axis labels completely
- Warning message when creating a grouped boxplot
- Plots seem merged when using `subplot` in `plotly`
- Top and Bottom plots seem to have less spacing when using `subplot` in `plotly` HOT 1
- `updatemenus` > `buttons` don't behave as expected when restyling `y` axis (ignores `color` channel)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.r.