1
0

error_bars_asymmetric.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright 2021-2024 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. import random
  17. from taipy.gui import Gui
  18. # Number of samples
  19. n_samples = 10
  20. # y values: [0..n_samples-1]
  21. y = range(0, n_samples)
  22. data = {
  23. # The x series is made of random numbers between 1 and 10
  24. "x": [random.uniform(1, 10) for _ in y],
  25. "y": y,
  26. }
  27. options = {
  28. "error_x": {
  29. "type": "data",
  30. # Allows for a 'plus' and a 'minus' error data
  31. "symmetric": False,
  32. # The 'plus' error data is a series of random numbers
  33. "array": [random.uniform(0, 5) for _ in y],
  34. # The 'minus' error data is a series of random numbers
  35. "arrayminus": [random.uniform(0, 2) for _ in y],
  36. # Color of the error bar
  37. "color": "red",
  38. }
  39. }
  40. page = """
  41. <|{data}|chart|type=bar|x=x|y=y|orientation=h|options={options}|>
  42. """
  43. if __name__ == "__main__":
  44. Gui(page).run(title="Chart - Error bars - Asymmetric")