I have two variables:

  • A is an integer from 0-1000u (u=some arbitrary unit)
  • B is either 1 or 0

I need to visualize a graph (or graphs) to show the relationship of A & B (y-axis) against t (time; x-axis) and also relationship between A & B

I tried showing them on one graph, but having Boolean and integer value on the same y-axis looks incorrect.

I could just do 2 separate graphs: A/t & B/t but I'm wondering if there's a more elegant way of visualizing this which also shows the relationship between A & B more clearly.

2 Answers 2


You might get better answer at Cross Validated SE but I'd use a graph with two y-axis. One axis with values from 0 to 1000 and the other with values 0 to 1. Having values from 0 to 1000 shown as line and values from 0 to 1 as bars results in the following graph. Presenting the boolean value as stepped line might be more suitable though.

enter image description here


I recommend the binary variable to be represented by background color (see mockup below). This way, it would provide context, or tight spatial relationship, with the numeric variable line over it.

chart proposal

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.