PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, April 23, 2022

[FIXED] how to adjust title space and plot plotly in r

 April 23, 2022     layout, pie-chart, plotly, r     No comments   

Issue

gpX83= plot_ly(df_X83, 
           labels = ~Var1, 
           values=~Freq, 
           type ='pie', sort = F) %>% layout(title = list(text = paste0('Gráfico 83.1','<br>', '<sup>',
                                'Com que frequência você participou de novas capacitações?','</sup>'),x = 0.1), 
     colorway = c('#E41A1C', '#377EB8' , '#4DAF4A', '#984EA3','#FF7F00', '#FFFF33', '#A65628', '#F781BF'),
     legend= list(orientation='h')) 

enter image description here

I need to give a space between the title and area of the graph, does anyone know what function to use?


Solution

The margin needs a workaround. It can be added to the layout as margin =.

For example:

mrg <- list(l = 50, r = 50,
          b = 50, t = 50,
          pad = 20)

gpX83 <- plot_ly(df, labels = ~Project, values=~Emissions,
                 type ='pie', sort = F) %>%
  layout(title = list(text = paste0('Gráfico 83.1','<br>', '<sup>',
                                    'Com que frequência você participou de novas capacitações?','</sup>'),x = 0.1),
         colorway = c('#E41A1C', '#377EB8' , '#4DAF4A', '#984EA3','#FF7F00', '#FFFF33', '#A65628', '#F781BF'),
         legend= list(orientation='h'), 
         margin = mrg) 


Answered By - Mohanasundaram
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing