Skip to content

Commit 3d0e319

Browse files
committed
Translate font faces in axis titles. Fixes #861
1 parent 32aba50 commit 3d0e319

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616

1717
## CHANGES
1818

19-
* Upgraded to plotly.js v1.24.1 -- https://github.com/plotly/plotly.js/releases/tag/v1.24.1
19+
* Upgraded to plotly.js v1.24.2 -- https://github.com/plotly/plotly.js/releases/tag/v1.24.2
2020
* `HTMLwidgets.renderValue()` now calls `Plotly.redraw()` instead of `Plotly.newPlot()`. (thanks @AleksandrIanevski)
2121
* A TypedArray polyfill is now included by default, and the function `remove_typedarray_polyfill()` was added to make it easy to remove it. Fixes #824, #717, #825.
2222
* If no graphics device is already open, `ggplotly()` now tries to open/close a Cairo graphics device, then a bitmap (png/jpeg) device. If neither is available, it errors. This helps to ensure that a *screen* device is never opened by `ggplotly()` (which fixes #829). Furthermore, if `width`/`height` is not specified *and* no graphics device is currently open, a default of 640/480 is used for width/height of the device.
2323

2424
## BUG FIXES
2525

2626
* Fix for hoverinfo displaying the heights of bars in the translation `geom_bar()` via `ggplotly()`. Fixes #557 and #662.
27+
* Font faces for axis titles are now translated in `ggplotly()`. Fixes #861.
2728

2829
# 4.5.6
2930

R/ggplotly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ gg2list <- function(p, width = NULL, height = NULL,
584584
gridwidth = unitConvert(panelGrid, "pixels", type),
585585
zeroline = FALSE,
586586
anchor = anchor,
587-
title = axisTitleText,
587+
title = faced(axisTitleText, axisTitle$face),
588588
titlefont = text2font(axisTitle)
589589
)
590590
# convert dates to milliseconds (86400000 = 24 * 60 * 60 * 1000)

tests/testthat/test-cookbook-axes.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ bp.fonts <- bp +
133133
test_that("element_text face, colour, size, angle, vjust, size", {
134134
info <- expect_traces(bp.fonts, 1, "fonts")
135135
expect_equal(info$layout$xaxis$tickangle, -90)
136+
expect_equal(info$layout$xaxis$title, "<b>", fixed = TRUE)
137+
expect_equal(info$layout$xaxis$title, "</b>", fixed = TRUE)
136138
})
137139

138140
# Label formatters

0 commit comments

Comments
 (0)