What happens if in midair there is loss of power, how will the avionics perform in such a situation (cockpit display, flight plan)?
This is somewhat dependent on the aircraft of course, so I will focus on the Boeing 737 NG series as an example of a typical airliner. Details will differ with other aircraft, but the general concept should be the same.
When there is loss of thrust on both engines, both engine driven generators will stop providing power. The battery will take over powering some of the systems immediately. If two batteries are installed, all emergency systems can be supplied for at least 60 minutes:
Two 24 volt nickel–cadmium batteries, main and auxiliary, are located in the electronics compartment. The batteries can supply part of the DC system. The auxiliary battery operates in parallel with the main battery when the battery is powering the standby system. At all other times, the auxiliary battery is isolated from the power distribution system. Battery charging is automatically controlled. Two fully charged batteries have sufficient capacity to provide standby power for a minimum of 60 minutes. Battery voltage range is 22–30 volts.
(Boeing 737 NG FCOMv2 6.20.12 Electrical - System Description)
The batteries power some DC buses directly and the AC standby bus via a static inverter:
Standby Power System - Normal Operation
The standby system provides 115V AC and 24V DC power to essential systems in the event of loss of all engine or APU–driven AC power. The standby power system consists of:
- static inverter
- AC standby bus
- DC standby bus
- battery bus
- hot battery bus
- switched hot battery bus
- main battery
- auxiliary battery.
The static inverter converts 24 volt DC power from the battery to 115V AC power to supply the AC standby bus during the loss of normal electrical power. The power supply to the inverter is controlled by the standby power switch and the battery switch on the overhead panel.
(Boeing 737 NG FCOMv2 6.20.16 Electrical - System Description)
The FCOM contains a long list with all systems that are powered in this configuration. In general, only the captain's side instruments will be available. I will not quote the full list here, since you only asked about "cockpit display, flight plan". The relevant items are:
All Generators Inoperative
The following list identifies the significant equipment that operates when the main battery and the auxiliary battery are the only source of electrical power.
- emergency instrument flood lights
- Captain's pitot probe heat
- VHF No. 1
- upper display unit
- Captain's outboard and inboard display units (EFIS/MAP or PFD/ND)
- left EFIS control panel
- Standby instruments
- left CDU
- heading/track indications
- VHF NAV No. 1
- ILS No. 1
- left IRS
- left GPS
(Boeing 737 NG FCOMv2 6.20.19 Electrical - System Description)
This allows the Captain to continue flying the aircraft via manual reversion (no hydraulic pressure will be available, no autopilot is available). An emergency descent will have to be initiated without thrust. The checklist in the QRH will aim at restarting one or both engines. If that fails, the APU can be started in flight below 25,000 ft to provide more electrical power (all AC buses powered, all displays available again, electric hydraulic pumps available again).
Although the accepted answer is basically correct, as an additional backup source of power (for hydraulics or electric, depending on the aircraft), there can be a Ram air turbine (RAT - https://en.wikipedia.org/wiki/Ram_air_turbine) that can be deployed in a failure of both primary and secondary energy sources. It uses the airflow from the airplane's speed in the air to generate energy for hydraulics or electrical needs.