8000 Minor image fix by HammadTheOne · Pull Request #71 · plotly/plotly.r-docs · GitHub
[go: up one dir, main page]

Skip to content

Minor image fix #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions r/2020-02-25-images.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: How to display image data in Python with R.
description: How to display image data with R.
display_as: scientific
language: r
layout: base
Expand Down Expand Up @@ -40,7 +40,7 @@ library(EBImage)

img = readImage('https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/240px-Crab_Nebula.jpg')

fig <- plot_ly(type="image", z=img*255)
fig <- plot_ly(type="image", z=img*255)
fig
```
### Define the data range covered by the color range with zmin and zmax
Expand All @@ -54,11 +54,11 @@ library(EBImage)

img = readImage('https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/240px-Crab_Nebula.jpg')
# Stretch the contrast of the red channel only, resulting in a more red image
fig <- plot_ly(type="image", z=img*250,
fig <- plot_ly(type="image", z=img*250,
zmin=c(10, 0, 0), zmax=c(200, 250, 250))
fig
```
### Set Ticks and Margins
### Set Ticks and Margins

```{r}
library(plotly)
Expand All @@ -74,11 +74,11 @@ fig

### Drawing Shapes on Images

You can create layout shapes programatically, but you can also draw shapes manually by setting the `dragmode` to one of the shape-drawing modes: `drawline`,`drawopenpath`, `drawclosedpath`, `drawcircle`, or `drawrect`. If you need to switch between different shape-drawing or other dragmodes (panning, selecting, etc.), modebar buttons can be added in the `config` of your figure to select the dragmode.
You can create layout shapes programatically, but you can also draw shapes manually by setting the `dragmode` to one of the shape-drawing modes: `drawline`,`drawopenpath`, `drawclosedpath`, `drawcircle`, or `drawrect`. If you need to switch between different shape-drawing or other dragmodes (panning, selecting, etc.), modebar buttons can be added in the `config` of your figure to select the dragmode.

If you switch to a different dragmode such as pan or zoom, you will need to select the drawing tool in the modebar to go back to shape drawing.

This shape-drawing feature is particularly interesting for annotating graphs, in particular [image traces](https://plotly.com/r/displaying-images/).
This shape-drawing feature is particularly interesting for annotating graphs, in particular [image traces](https://plotly.com/r/displaying-images/).

Once you have drawn shapes, you can select and modify an existing shape by clicking on its boundary (note the arrow pointer). Its fillcolor turns to pink to highlight the activated shape and then you can

Expand All @@ -98,7 +98,7 @@ library(EBImage)

img = readImage('https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Crab_Nebula.jpg/240px-Crab_Nebula.jpg')

fig <- plot_ly(type="image", z=img*255)
fig <- plot_ly(type="image", z=img*255)

fig <- layout(fig, dragmode="drawrect", xaxis = list(title = 'Click and drag inside the figure to draw a rectangle or select another shape in the modebar'))

Expand All @@ -110,4 +110,4 @@ fig
```

### Reference
See [https://plotly.com/r/reference/#image](https://plotly.com/r/reference/#area) for more information and chart attribute options!
See [https://plotly.com/r/reference/#image](https://plotly.com/r/reference/#area) for more information and chart attribute options!
1 change: 0 additions & 1 deletion r/2021-07-27-ml-pca.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ thumbnail: thumbnail/ml-pca.png
```{r, echo = FALSE, message=FALSE}
knitr::opts_chunk$set(message = FALSE, warning = FALSE)
```
## PCA Visualization in Python
Visualize Principle Component Analysis (PCA) of your high-dimensional data in R with Plotly.

This page first shows how to visualize higher dimension data using various Plotly figures combined with dimensionality reduction (aka projection). Then, we dive into the specific details of our projection algorithm.
Expand Down
2 changes: 1 addition & 1 deletion r/2021-08-03-horizontal-vertical-shapes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ output:
html_document:
keep_md: true
permalink: r/horizontal-vertical-shapes/
thumbnail: thumbnail/shape.png
thumbnail: thumbnail/shape.jpg
---

```{r, echo = FALSE, message=FALSE}
Expand Down
0