Bird
0
0

What will the following code print?

medium📝 Predict Output Q5 of 15
Matplotlib - Performance and Large Data
What will the following code print?
import holoviews as hv
hv.extension('bokeh')
data = [(i, i) for i in range(100000)]
points = hv.Points(data)
print(points.opts(tools=['hover']).opts(active_tools=['wheel_zoom']))
AA Matplotlib scatter plot
BAn error because opts is not a valid method
CA HoloViews Points object with hover and zoom tools enabled
DA Bokeh figure object
Step-by-Step Solution
Solution:
  1. Step 1: Understand HoloViews Points and opts

    HoloViews Points supports .opts() to set plot options like tools and active tools.
  2. Step 2: Recognize the output type

    Printing the Points object with options shows a configured HoloViews object, not a Matplotlib or Bokeh figure.
  3. Final Answer:

    A HoloViews Points object with hover and zoom tools enabled -> Option C
  4. Quick Check:

    HoloViews opts configures interactive tools [OK]
Quick Trick: HoloViews .opts() sets interactive tools on plots [OK]
Common Mistakes:
  • Expecting a Matplotlib plot
  • Thinking opts is invalid
  • Confusing with Bokeh figure directly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes