I have a dataset of the type:

data={{826777, "National Natural Science Foundation of China"}, {315253, 
  "National Science Foundation"}, {159274, 
  "U.S. Department of Energy"}, {133993, 
  "Japan Society for the Promotion of Science"}, {119710, 
  "Fundamental Research Funds for the Central Universities"}, {111064,
   "National Key Research and Development Program of China"}, {108416,
   "National Institutes of Health"}, {103238, 
  "Deutsche Forschungsgemeinschaft"}, {85648, 
  "National Research Foundation of Korea"}, {80981, 
  "Seventh Framework Programme"}, {79600, 
  "Engineering and Physical Sciences Research Council"}, {78383, 
  "European Commission"}, {74952, 
  "Natural Sciences and Engineering Research Council of Canada"}, \
{73368, "Horizon 2020 Framework Programme"}, {67414, 
  "Conselho Nacional de Desenvolvimento Científico e Tecnológico"}, \
{57697, "Russian Foundation for Basic Research"}, {56817, 
  "China Postdoctoral Science Foundation"}, {54863, 
  "Ministry of Education, Culture, Sports, Science and Technology"}, \
{53150, "Chinese Academy of Sciences"}, {52416, 
  "European Regional Development Fund"}, {42511, 
  "Office of Science"}, {36152, "European Research Council"}, {34774, 
  "Coordenação de Aperfeiçoamento de Pessoal de Nível Superior"}, \
{33632, "National Basic Research Program of China (973 Program)"}, \
{30444, "Ministry of Science, ICT and Future Planning"}, {28627, 
  "Basic Energy Sciences"}, {27370, 
  "Directorate for Mathematical and Physical Sciences"}, {26223, 
  "Natural Science Foundation of Jiangsu Province"}, {25302, 
  "National Institute of General Medical Sciences"}, {24688, 
  "China Scholarship Council"}, {24341, 
  "Ministry of Education of the People's Republic of China"}, {21671, 
  "Fundação de Amparo à Pesquisa do Estado de São Paulo"}, {18971, 
  "National Aeronautics and Space Administration"}, {17687, 
  "Priority Academic Program Development of Jiangsu Higher Education \
Institutions"}, {17626, "Ministry of Education"}, {17503, 
  "Ministerio de Economía y Competitividad"}, {16194, 
  "Ministry of Science and Technology of the People's Republic of \

I would like to generate a histogram of word and number as shown in Figure bellow:

enter image description here

I tried using the following code:

Histogram[Mdata2, Automatic, BarOrigin -> Left, 
 PlotRange -> {-0.1, 1}, Axes -> {True, False}, Frame -> True, 
 AxesOrigin -> {0, 0}, AxesStyle -> Thick]

But the output was

enter image description here

Can anybody help me?

Thank you in advance.


2 Answers 2


First of all, you don't need a Histogram, you need BarChart. Secondly, you need to massage the data slightly so each data point is associated with its label.

This is a possible approach:

  Labeled[#1, #2] & @@@ Sort@data,
  BarOrigin -> Left, Frame -> True,
  AspectRatio -> 1, ImageSize -> Full

desired bar chart


Another way that includes your chart colour and gridlines

 Sort[data][[All, 1]],
 ChartLabels -> Sort[data][[All, 2]],
 BarOrigin -> Left,
 ChartStyle -> LightBlue,
 GridLines -> {Automatic, None}

enter image description here


To get even closer with the colours requested on the original example we can get the correct blue with DominantColors


And we can also use EdgeForm->None to remove the borders on the bar and use TicksStyle -> Opacity[0] to delete the ticks near the labels and LabelStyle -> Opacity[1] to keep the text.


 Sort[data][[All, 1]],
 ChartLabels -> Sort[data][[All, 2]],
 BarOrigin -> Left,
 ChartStyle -> {chartColorsOnBar, {EdgeForm -> 
     None}},(*correct shade of blue and no edges*)
 GridLines -> {Automatic, None},
 TicksStyle -> Opacity[0],(*remove tick marks near labels*)
 LabelStyle -> Opacity[1](*remove tick marks near labels*)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.