plot two charts only when necessary