☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Rbokeh barplot x-axis reordered by y-axis value

Community Support
Wookeun_Lee
Wookeun_Lee

Here is a simple example of barplot expressed in Rbokeh.

library(rbokeh)

total yield per variety

figure() %>%

ly_bar(variety, yield, data = lattice::barley, hover = TRUE) %>%

theme_axis(“x”, major_label_orientation = 90)

Result are shown as below

Question 1)

I want to plot bars, reordered on x-axis by yield in descending order like below

I know that there’s simple way of doing this in ggplot with ‘reorder’ function, but have no idea how to do this in Rbokeh.

How can I do this?

Question 2)

Running the code above, I can see this error message, what does this mean and how can I solve this problem?

Warning messages:

1: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

2: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

3: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

4: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

5: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

6: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

7: In structure(x, class = unique(c(“AsIs”, oldClass(x)))) :

Calling ‘structure(NULL, *)’ is deprecated, as NULL cannot have attributes.

Consider ‘structure(list(), *)’ instead.

⌁   Link to post
Bryan
Bryan

Hi,

Regardless of language, sorting the columns means sorting the list of factors that make up the underlying FactorRange object. Here is how you can do it in Python, e.g.

  https://bokeh.pydata.org/en/latest/docs/user_guide/categorical.html#sorting

I am not sure if the list of factors is easily configurable in the current RBokeh binding. You might have better luck posing this question on the rbokeh GH issue tracker.

Thanks,

Bryan

···

On Feb 6, 2019, at 07:29, Wookeun Lee <yiugn79@gmail.com> wrote:

Here is a simple example of barplot expressed in Rbokeh.

    library(rbokeh)
    
    # total yield per variety
    figure() %>%
      ly_bar(variety, yield, data = lattice::barley, hover = TRUE) %>%
      theme_axis("x", major_label_orientation = 90)

Result are shown as below

<캡처.PNG>

**Question 1)**
I want to plot bars, reordered on x-axis by yield in descending order like below

I know that there's simple way of doing this in ggplot with 'reorder' function, but have no idea how to do this in Rbokeh.

How can I do this?

**Question 2)**
Running the code above, I can see this error message, what does this mean and how can I solve this problem?

    Warning messages:
    1: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    2: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    3: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    4: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    5: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    6: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.
    7: In structure(x, class = unique(c("AsIs", oldClass(x)))) :
      Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
      Consider 'structure(list(), *)' instead.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/aa44d27b-228b-43b7-8ee3-d95df7878436%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<캡처.PNG>

⌁   Link to post

End of archived discussion · Replies are disabled