Yunnan has a generally mild climate with pleasant and fair weather because of the province's location on south-facing mountain slopes, receiving the influence of both the Pacific and Indian oceans. Although the growing period is long, there is little arable land. January average temperatures range from 8°C to 17°C; July averages vary from 21°C to 27°C. Average annual rainfall ranges from 600 mm to 2,300 mm, with over half the rain occurring between June and August. The plateau region has moderate temperatures. The western canyon region is hot and humid at the valley bottoms, but there are freezing winds at the mountain tops. It's not easy to summarize an average value for Yunnan's climate due to its vast diversity (from subtropical jungle lowlands in the south up to glacier caped mountains in the north). Please find a climate overview of some of Yunnan's cities further below.
If you had to pick a single province in all China that would expose you to the greatest variations in topography and climate, it would have to be Yunnan Province. There is an old and accurate saying here that "You can enjoy all four seasons on the same mountain, where each of these four season is only a few miles distant from the others.
So, the best time to visit Yunnan Province depends clearly on the region you like to visit. Yunnan is a very diverse province with the Himalayas in the north and subtropics in the south. Thus, there are also specific times of the year when it’s best to visit certain destinations. If you’d like to visit Yunnan in January for example, you should prevent to go north to Shangri-La or Deqin. During this time, the Yuanyang Rice Terraces or Xishuangbanna（Xishuangbanna Tropical Botanical Garden, Menglun）would be recommended to visit though.
The dry season usually starts in September / October and lasts until May / June. During this time, sunshine is plentiful, rain infrequent and the humidity is not yet a factor to be reckoned with. The rainy season usually lasts from June to September. Most temperate parts of the province can be enjoyed all year round though. So actually, the best time to visit Yunnan Province is when you're free!
For further information on climate in Yunnan and elsewhere this website is highly recommended!