scatter_more_styling.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright 2021-2025 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. # -----------------------------------------------------------------------------------------
  12. # To execute this script, make sure that the taipy-gui package is installed in your
  13. # Python environment and run:
  14. # python <script>
  15. # -----------------------------------------------------------------------------------------
  16. from taipy.gui import Gui
  17. data = [
  18. {
  19. "x": [1, 2, 3, 4],
  20. "y": [10, 11, 12, 13],
  21. },
  22. {
  23. "x": [1, 2, 3, 4],
  24. "y": [11, 12, 13, 14],
  25. },
  26. {
  27. "x": [1, 2, 3, 4],
  28. "y": [12, 13, 14, 15],
  29. },
  30. ]
  31. options = [
  32. # First data set is represented by increasingly large
  33. # disks, getting more and more opaque
  34. {"marker": {"color": "red", "size": [12, 22, 32, 42], "opacity": [0.2, 0.5, 0.7, 1]}},
  35. # Second data set is represented with a different symbol
  36. # for each data point
  37. {
  38. "marker": {"color": "blue", "size": 18, "symbol": ["circle", "square", "diamond", "cross"]},
  39. },
  40. # Third data set is represented with green disks surrounded
  41. # by a red circle that becomes thicker and thicker
  42. {
  43. "marker": {"color": "green", "size": 20, "line": {"color": "red", "width": [2, 4, 6, 8]}},
  44. },
  45. ]
  46. markers = [
  47. # First data set is represented by increasingly large
  48. # disks, getting more and more opaque
  49. {"color": "red", "size": [12, 22, 32, 42], "opacity": [0.2, 0.5, 0.7, 1]},
  50. # Second data set is represented with a different symbol
  51. # for each data point
  52. {"color": "blue", "size": 18, "symbol": ["circle", "square", "diamond", "cross"]},
  53. # Third data set is represented with green disks surrounded
  54. # by a red circle that becomes thicker and thicker
  55. {"color": "green", "size": 20, "line": {"color": "red", "width": [2, 4, 6, 8]}},
  56. ]
  57. layout = {
  58. # Hide the chart legend
  59. "showlegend": False,
  60. # Remove all ticks from the x axis
  61. "xaxis": {"showticklabels": False},
  62. # Remove all ticks from the y axis
  63. "yaxis": {"showticklabels": False},
  64. }
  65. page = """
  66. <|{data}|chart|mode=markers|layout={layout}|marker={markers}|>
  67. """
  68. if __name__ == "__main__":
  69. Gui(page).run(title="Chart - Scatter - Customize markers")