Skip to content

use Plotly axis titles if not facetted #574

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 6 commits into from
May 5, 2016
Merged

use Plotly axis titles if not facetted #574

merged 6 commits into from
May 5, 2016

Conversation

timelyportfolio
Copy link
Collaborator

Closes #573 to pull from ropensci remote. Also rebase to current master.

As reported in #510, axis titles can be positioned improperly depending on the size of the plot. In a2aedac, axis titles were changed to annotations, so they are not duplicated and work much more similarly to ggplot2. Unfortunately, plotly annotations are positioned based on a [0,1] scale with respect to the plot area. This means the axis titles scale inversely and negatively to the plot size. When the plot is small, the x axis title will be placed too high. When the plot is large/high, the x axis title moves too far down sometimes out of the svg bounding box.

This pull changes to use plotly axis titles when the plot is not facetted. When the plot is facetted, the plotly axis titles are changed to "" in favor of the annotation approach.

@cpsievert
Copy link
Collaborator

The message below was automatically generated after build https://travis-ci.org/ropensci/plotly/builds/127984589

Detected 215 differences ->

http://cpsievert.github.io/plotly-test-table/4d11cd7/3-panels
http://cpsievert.github.io/plotly-test-table/4d11cd7/all-shapes
http://cpsievert.github.io/plotly-test-table/4d11cd7/area-area-fillcolor
http://cpsievert.github.io/plotly-test-table/4d11cd7/area-simple
http://cpsievert.github.io/plotly-test-table/4d11cd7/area-traces_order
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-aes-colour-guides-fill-FALSE
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-aes-fill-guides-color-none
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-black-outline
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-category-names
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-coord-flip
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-dates
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-dodge
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-identity
http://cpsievert.github.io/plotly-test-table/4d11cd7/barley
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-nocolor
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-position-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-position-stack
http://cpsievert.github.io/plotly-test-table/4d11cd7/bar-stack
http://cpsievert.github.io/plotly-test-table/4d11cd7/boxplot
http://cpsievert.github.io/plotly-test-table/4d11cd7/boxplot-datetime
http://cpsievert.github.io/plotly-test-table/4d11cd7/boxplot-fillcolor
http://cpsievert.github.io/plotly-test-table/4d11cd7/boxplot-legends_for_fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/contour
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-dodge-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-dodge-color-err4
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-dodge-color-error
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-error-diff
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-error-narrow
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-bar-error-wide
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-basic-bar
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-basic-horizontal-line
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-blank-minor
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-blank-minor-major
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-blank-x
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-blank-y
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-coord-ylim
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-custom-formatter
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-dashed-red-line
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-flevels
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-fonts
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-label-funs
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-linear-axes
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-log2-coord
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-log2-labels
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-log2-scale
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-multiple-abline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-no-x-title
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scale.hide
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scale-name
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scale_y_log10
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scale_y_log10-labels
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-basic
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-facet
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-facet-hline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-facet-hline-vline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-hline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-scatter-hline-vline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-single-abline
http://cpsievert.github.io/plotly-test-table/4d11cd7/cookbook-axes-ylim.hide
http://cpsievert.github.io/plotly-test-table/4d11cd7/date-class-Date
http://cpsievert.github.io/plotly-test-table/4d11cd7/date-irregular-time-series
http://cpsievert.github.io/plotly-test-table/4d11cd7/date-strings
http://cpsievert.github.io/plotly-test-table/4d11cd7/density2d
http://cpsievert.github.io/plotly-test-table/4d11cd7/density2dfill
http://cpsievert.github.io/plotly-test-table/4d11cd7/density-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/density-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/density-histogram
http://cpsievert.github.io/plotly-test-table/4d11cd7/density-simple
http://cpsievert.github.io/plotly-test-table/4d11cd7/density-traces_order
http://cpsievert.github.io/plotly-test-table/4d11cd7/errorbar
http://cpsievert.github.io/plotly-test-table/4d11cd7/errorbar-horizontal
http://cpsievert.github.io/plotly-test-table/4d11cd7/errorbar-unique-groups
http://cpsievert.github.io/plotly-test-table/4d11cd7/error-rect-alpha
http://cpsievert.github.io/plotly-test-table/4d11cd7/error-simple
http://cpsievert.github.io/plotly-test-table/4d11cd7/error-simple-line
http://cpsievert.github.io/plotly-test-table/4d11cd7/error-simple-line-point
http://cpsievert.github.io/plotly-test-table/4d11cd7/error-simple-line-point-crazy
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_grid_free
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_grid_free_x
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_grid_free_y
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_grid-labeller
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap_free
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap_free_mult
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap_free_x
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap_free_y
http://cpsievert.github.io/plotly-test-table/4d11cd7/facet_wrap-labeller
http://cpsievert.github.io/plotly-test-table/4d11cd7/heatmap
http://cpsievert.github.io/plotly-test-table/4d11cd7/heatmap-discrete
http://cpsievert.github.io/plotly-test-table/4d11cd7/heatmap-discrete-tooltip
http://cpsievert.github.io/plotly-test-table/4d11cd7/heatmap-midpoint
http://cpsievert.github.io/plotly-test-table/4d11cd7/hex-basic
http://cpsievert.github.io/plotly-test-table/4d11cd7/hex-bins
http://cpsievert.github.io/plotly-test-table/4d11cd7/hex-binwidth
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-counts
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-Date-bins
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-dates
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-density
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-density-binwidth
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fill-factor
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fill-factor-dodge
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fill-factor-facets
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fill-factor-identity
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-fixed-fill-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-POSIXt-bins
http://cpsievert.github.io/plotly-test-table/4d11cd7/histogram-vline
http://cpsievert.github.io/plotly-test-table/4d11cd7/hline
http://cpsievert.github.io/plotly-test-table/4d11cd7/hline-factor
http://cpsievert.github.io/plotly-test-table/4d11cd7/hline-multiple
http://cpsievert.github.io/plotly-test-table/4d11cd7/jitter-basic
http://cpsievert.github.io/plotly-test-table/4d11cd7/labels-angles
http://cpsievert.github.io/plotly-test-table/4d11cd7/labels-ggtitle
http://cpsievert.github.io/plotly-test-table/4d11cd7/labels-ylab
http://cpsievert.github.io/plotly-test-table/4d11cd7/legend-hide
http://cpsievert.github.io/plotly-test-table/4d11cd7/legend-many-legend-items
http://cpsievert.github.io/plotly-test-table/4d11cd7/legend-very-long-legend-items
http://cpsievert.github.io/plotly-test-table/4d11cd7/linetype-colors
http://cpsievert.github.io/plotly-test-table/4d11cd7/linetype-types
http://cpsievert.github.io/plotly-test-table/4d11cd7/map-facet
http://cpsievert.github.io/plotly-test-table/4d11cd7/open-shapes
http://cpsievert.github.io/plotly-test-table/4d11cd7/path-colored-groups-stay-together
http://cpsievert.github.io/plotly-test-table/4d11cd7/path-colors
http://cpsievert.github.io/plotly-test-table/4d11cd7/path-colors2
http://cpsievert.github.io/plotly-test-table/4d11cd7/path-lines-diff-from-paths
http://cpsievert.github.io/plotly-test-table/4d11cd7/path-line-symbols
http://cpsievert.github.io/plotly-test-table/4d11cd7/point-box
http://cpsievert.github.io/plotly-test-table/4d11cd7/point-size-alpha
http://cpsievert.github.io/plotly-test-table/4d11cd7/point-size-alpha2
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-aes-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-aes-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-black
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-color-aes-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-color-fill-aes-linetype
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-color-fill-aes-size
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygons-canada-borders
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-star-fill-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-star-group
http://cpsievert.github.io/plotly-test-table/4d11cd7/polygon-star-group-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-black
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-black4
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-fill-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/rect-fill-hex-alpha
http://cpsievert.github.io/plotly-test-table/4d11cd7/ribbon-alpha
http://cpsievert.github.io/plotly-test-table/4d11cd7/ribbon-colour
http://cpsievert.github.io/plotly-test-table/4d11cd7/ribbon-fill
http://cpsievert.github.io/plotly-test-table/4d11cd7/ribbon-group
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatter_legend
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-color
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-full-range
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-geom_jitter
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-hollow
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-jitter
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-loess
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-overlap
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-scale-color-hue
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-shape
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-shape-manual
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-smooth-lm
http://cpsievert.github.io/plotly-test-table/4d11cd7/scatterplots-smooth-lm-se-false
http://cpsievert.github.io/plotly-test-table/4d11cd7/segment
http://cpsievert.github.io/plotly-test-table/4d11cd7/segment-multiple-non-numeric
http://cpsievert.github.io/plotly-test-table/4d11cd7/size-global-scaling
http://cpsievert.github.io/plotly-test-table/4d11cd7/size-is-a-vector
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-basic
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-colour
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-facet
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-fill2
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-group
http://cpsievert.github.io/plotly-test-table/4d11cd7/smooth-se-false
http://cpsievert.github.io/plotly-test-table/4d11cd7/step-gg.hv
http://cpsievert.github.io/plotly-test-table/4d11cd7/step-gg.hvh
http://cpsievert.github.io/plotly-test-table/4d11cd7/step-gg.vh
http://cpsievert.github.io/plotly-test-table/4d11cd7/step-gg.vhv
http://cpsievert.github.io/plotly-test-table/4d11cd7/text
http://cpsievert.github.io/plotly-test-table/4d11cd7/text-colour
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-background
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-marker-default
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-panel-border-1
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-panel-border-2
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-ticks-and-grids
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-ticks-default
http://cpsievert.github.io/plotly-test-table/4d11cd7/theme-zeroline-default
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-boxes
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-boxes-facet-grid
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-boxes-scales-free
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-boxes-space-free
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-breaks-less
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-breaks-more
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-breaks-nochange
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-evenly-spaced-ticks
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-flip
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-flip-grid
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-flip-grid-free
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-hide-ticks-labels
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-hide-ticks-lines-labels
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-limits-gap
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-limits-hide
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-scale-labels
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-uneven
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-ycontinuous-ranges
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-ylim-ranges
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-ylim-reversed-ranges
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-yreverse-limits-ranges
http://cpsievert.github.io/plotly-test-table/4d11cd7/ticks-yreverse-ranges
http://cpsievert.github.io/plotly-test-table/4d11cd7/tooltip-date
http://cpsievert.github.io/plotly-test-table/4d11cd7/tooltip-datetime
http://cpsievert.github.io/plotly-test-table/4d11cd7/violin
http://cpsievert.github.io/plotly-test-table/4d11cd7/violin-aes
http://cpsievert.github.io/plotly-test-table/4d11cd7/vline
http://cpsievert.github.io/plotly-test-table/4d11cd7/vline-multiple
http://cpsievert.github.io/plotly-test-table/4d11cd7/ylim-one-trace

@cpsievert cpsievert merged commit d136b69 into master May 5, 2016
@cpsievert cpsievert deleted the fix/axis-labels branch May 5, 2016 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants