Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. import plotly.plotly as py
  2. from plotly.graph_objs import *
  3. py.sign_in('username', 'api_key')
  4. trace1 = {
  5. "x": ["1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003"],
  6. "y": ["5194", "7786", "10769", "8391", "9581", "10829", "21784", "26606", "29777", "30024", "38881", "51014", "54871", "84600", "96726", "98666", "131391", "146131", "155608", "177500", "207394", "201819", "230511", "243795", "254711", "254463", "260216", "282013", "286803", "540713", "345438", "319317", "313023", "317317", "323486", "340923", "355177", "359841", "377076", "420709", "448915", "489834", "529790", "545382", "594646", "646046", "646037", "674843", "729620", "727668", "731697", "689616", "647456", "584550", "435045", "308206", "171275", "131196", "100193", "75861", "44230", "22389", "5724", "2"],
  7. "hoverinfo": "y+text",
  8. "marker": {
  9. "color": ["5194", "7786", "10769", "8391", "9581", "10829", "21784", "26606", "29777", "30024", "38881", "51014", "54871", "84600", "96726", "98666", "131391", "146131", "155608", "177500", "207394", "201819", "230511", "243795", "254711", "254463", "260216", "282013", "286803", "540713", "345438", "319317", "313023", "317317", "323486", "340923", "355177", "359841", "377076", "420709", "448915", "489834", "529790", "545382", "594646", "646046", "646037", "674843", "729620", "727668", "731697", "689616", "647456", "584550", "435045", "308206", "171275", "131196", "100193", "75861", "44230", "22389", "5724", "2"],
  10. "colorscale": [
  11. [0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1, "#f0f921],
  12. "colorsrc": ""
  13. },
  14. "orientation": "v",
  15. "text": ["1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003"],
  16. "textsrc": "",
  17. "type": "bar",
  18. "xsrc": "",
  19. "ysrc": ""
  20. }
  21. data = Data([trace1])
  22. layout = {
  23. "autosize": True,
  24. "font": {"family": "Arial"},
  25. "plot_bgcolor": "rgb(170, 176, 179)",
  26. "title": {"text": "<b>Subscribers by Year of Birth</b>"},
  27. "xaxis": {
  28. "autorange": True,
  29. "range": [1939.5, 2003.5],
  30. "title": {"text": "<b>Year of Birth</b>"},
  31. "type": "linear"
  32. },
  33. "yaxis": {
  34. "autorange": True,
  35. "range": [0, 770207.3684210526],
  36. "title": {"text": "<b>Number of Subscribers</b>"},
  37. "type": "linear"
  38. }
  39. }
  40. fig = Figure(data=data, layout=layout)
  41. plot_url = py.plot(fig)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement