plotly / plotly/plotly.R

Why tickvals/ticktext is not showing on x-axis in population pyramid graph

Open
#1,955 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Creating instance of the figure

fig = gp.Figure()

Adding Male data to the figure

fig.add_trace(gp.Bar(y= y_age, x = x_M,
name = 'Male', orientation = 'h'))

Adding Female data to the figure

fig.add_trace(gp.Bar(y = y_age, x = x_F,
name = 'Female', orientation = 'h'))

Updating the layout for our graph

fig.update_layout(title = 'Population Pyramid of Registration Data',
title_font_size = 22, barmode = 'relative',
bargap = 0.6, bargroupgap = 0,
xaxis = dict(tickvals = [-1000, -800, -600, -400, -200, 0, 200, 400, 600, 800, 1000],

						                 ticktext = ['10H', '8H',  '6H', '4H', '2H', 
                                        '0', '2H', '4H', '6H', '8H', '10H'],
							
						                 title = 'Population in Hundreds',
						                 title_font_size = 12)
		       	   )

fig.show()

image
PP graph.docx

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied R population-pyramid example, especially the xaxis tickvals and ticktext settings, and inspect the behavior around fig.show(). Confirm whether the configured labels appear on the x-axis; done means the example renders the requested tick labels correctly or documents the limitation and its cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.